Full Version: Query with Parameter Won't Work When It Used To!!
UtterAccess Discussion Forums > Microsoft® Access > Access Queries
PsuFan
Hi...I need help as I am not sure why my query returns no results when it was return correct results a few days ago. I have two tables, one containing only student id's (DS Students) and the other containing student ids, full names, and other data (Students). They are joined by id. I am running a query pulling Students.fullname and DS_Students.id. My parameter/criteria under the fullname column is as follows: Like [Enter Student's Last Name] & "*". If you don't enter the requested information, you will see a full listing of all students names and ids. If you try to enter a name or part of a name, the query returns no results. It was working the other day and now it is not. I have no idea why, when nothing has changed. Anyone have any ideas? Thanks in advance for your thoughts.
Doug Steele
Just to confirm, are you still being prompted?

What's the actual SQL of your query?
PsuFan
Yes, it is still prompting me to enter the students name (or part of the name which worked before). The SQL is as follows:

SELECT Student.fullname, [DS Students].id
FROM [DS Students] INNER JOIN Student ON [DS Students].id = Student.id
WHERE (((Student.fullname) Like [Enter Student's Last Name] & "*"))
ORDER BY Student.fullname;

Thanks!!
Doug Steele
Hmm. That should work. Might your database have been changed to ANSI-92? Just for giggles, try

SELECT Student.fullname, [DS Students].id
FROM [DS Students] INNER JOIN Student ON [DS Students].id = Student.id
WHERE Student.fullname Like [Enter Student's Last Name] & "%"
ORDER BY Student.fullname;

If that doesn't work, try:

PARAMETERS [Enter Student's Last Name] TEXT;
SELECT Student.fullname, [DS Students].id
FROM [DS Students] INNER JOIN Student ON [DS Students].id = Student.id
WHERE Student.fullname Like [Enter Student's Last Name] & "*"
ORDER BY Student.fullname;

(yes, that's a semi-colon between TEXT and SELECT)

and/or

PARAMETERS [Enter Student's Last Name] TEXT;
SELECT Student.fullname, [DS Students].id
FROM [DS Students] INNER JOIN Student ON [DS Students].id = Student.id
WHERE Student.fullname Like [Enter Student's Last Name] & "%"
ORDER BY Student.fullname;

(Note: I don't really think declaring the parameters will make a difference in this case)
PsuFan
Thanks Doug...I'll try that next week and let you know what happens! Maybe everything will magically work correctly once I return from Thanksgiving break! Have a good one...
PsuFan
Thank you, thank you! I tried the first option and it worked! Back in business. Appreciate your assistance...so much!
PsuFan
Hi, I'm back with the same problem! Now the solution that I tried won't work either! It was working, now its stopped. I went back to my original SQL, which then worked three times and stopped working. I checked the ANSI setting and it appears to be 92 version, not 89. Any other suggestions as to why this won't keep working? I am a new user and have run out of ideas on this one. Thanks, so much, for your assistance.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.