Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 To pass a parameter to SQL query

Author  Topic 

switchof
Starting Member

1 Post

Posted - 2011-08-03 : 15:21:25
Hi,

I have a form I created with Access 2003 that has a combo box on the top of the form and a list box at the bottom let's say.
Once a value is selected in the combo box, I need to have my SQL query to take the value and use it in the WHERE clause to join tables.
So to have: WHERE table1.name = combo1.value for example.

And afterwards the content of the joined table is to be displayed in the list box.
I put the SQL query in the "Row Source" of the list box, so after a value is selected in the combo box.

I tested it and I was asked by Access to put a value for the combo1.value so I guess SQL doesn't recognise combo1.value.

The display in the list box works after I put a value for combo1.value manually.

Any idea how to solve this?

Thanks a million in advance.
   

- Advertisement -