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

后端 未结 4 1169
甜味超标
甜味超标 2021-01-18 03:32
SELECT ID, 
       Name, 
       (SELECT CityName 
        FROM City 
        WHERE Employee.CityID = City.CityID) AS [City Name] 
FROM Employee 
WHERE [City Name] =         


        
相关标签:
4条回答
  • 2021-01-18 03:57

    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.

    0 讨论(0)
  • 2021-01-18 04:00

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

    0 讨论(0)
  • 2021-01-18 04:04

    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.

    0 讨论(0)
  • 2021-01-18 04:11

    try single quotes instead of double quotes.

    0 讨论(0)
提交回复
热议问题