mojo
July 21st, 1999, 09:55 PM
I'm writing some Access VBA code (DAO) for work and I want to pass the
value the user selects in a listbox to a SQL statement (using a query).
I tried this code:
....
[querydef name]. SQL = "SELECT * FROM TBL_Contacts & _
WHERE Country = '"lstCountry.Text"'"
It doesn't work though--that Access "Query Parameters" dialog box pops
up instead.
I feel silly asking this since I'm sure there must be a simple solution,
but I haven't been able to figure it out.. I also tried putting two sets
of double quotes around lstCountry.Text, but that didn't work either.
value the user selects in a listbox to a SQL statement (using a query).
I tried this code:
....
[querydef name]. SQL = "SELECT * FROM TBL_Contacts & _
WHERE Country = '"lstCountry.Text"'"
It doesn't work though--that Access "Query Parameters" dialog box pops
up instead.
I feel silly asking this since I'm sure there must be a simple solution,
but I haven't been able to figure it out.. I also tried putting two sets
of double quotes around lstCountry.Text, but that didn't work either.