Trouble writing a parameter query

NJudson

Who farted?
Local time
Yesterday, 22:52
Joined
Feb 14, 2002
Messages
297
Based on a suggestion from one of the posts on this site I tried to write a query that I will open from a form that has a criteria based on a selection from a combobox on the form. I'm using Access 2000 and the SQL for my query looks like this:

SELECT Table1.Field2, Table1.Field3
FROM Table1 LEFT JOIN Table2 ON Table1.Field2 = Table2.Field2
WHERE (((Table1.Field1)=[Forms]![MyForm]![Combobox]) AND ((Table2.Field2 Is Null));

What happens is when I click the button on the form to open the query, the "Enter parameter Value" box pops up.

Am I doing something wrong? Because I thought that the query should automatically open up looking at the form's combobox as the criteria, but instead it still prompts the user for input. Hope someone has any ideas. Thanks.
 
Thanks Pat. I apologize if I mis-stated my problem. I've created QueryDefs before with code so that shouldn't be a problem (hopefully!). However, just from what I've learned on this forum, you all say that it's better to use a stored query rather than an SQL query from code. The SQL that I written in the original post is the SQL for the stored query that I'd written. Is it possible to use a stored parameter query and have the query pull the parameter information from the form's combobox?
 

Users who are viewing this thread

Back
Top Bottom