Why am I getting “Enter Parameter Value” when running my MS Access query?
Asked Answered
C

5

10
SELECT ID, 
       Name, 
       (SELECT CityName 
        FROM City 
        WHERE Employee.CityID = City.CityID) AS [City Name] 
FROM Employee 
WHERE [City Name] = "New York"

I'm about selecting all employees who come New York but whenever I run the query, I always get a “Enter Parameter Value” box. How can I fix this?

Chillon answered 20/11, 2010 at 12:10 Comment(1)
Do you really have a column called [CityName] or is it [City Name]?Schwarz
M
9

This is because Access does not allow you to use field aliases in the query - it does not recognize [City Name] as a valid field name. Aliases are only used as field names in the result set. Rather, you need to use the entire expression.

As such, this query would probably be more easily defined in Access as:

SELECT ID, 
       Name, 
       CityName AS [City Name]
FROM Employee INNER JOIN City
    ON Employee.CityID=City.CityID
WHERE CityName = "New York"

Also, 'Name' is a reserved word - using it as a field name is not suggested.

Magulac answered 20/11, 2010 at 12:25 Comment(1)
I'm glad to hear it. Cheers.Magulac
F
0

Another thing to check is on the Home tab if you have any manual sorts or filters active on the query results. There is a button on that tab to remove sorting that you wont find on the dropdown menu for the field.

Frisch answered 9/8, 2018 at 17:37 Comment(0)
J
0

Check that you have not added a query to the "Default Value" field.

Jura answered 31/10, 2020 at 9:26 Comment(0)
P
-1

try single quotes instead of double quotes.

Plasm answered 20/11, 2010 at 12:14 Comment(1)
Single quotes are not a part of ms access sql syntax.Kohler
E
-1

Just found out regarding this error: "One of your parameter is invalid".

To fix this, I had to change my data type for customer ID from Large number to number as it does contain a few numbers only. This fixed my issue.

Enumerate answered 27/4, 2021 at 10:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.