Sql Backend

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a query which is a sqlPass through query. I want the query to take a
parameter from a form. How could i do this? An example:

This is an Access query :

Select * from Location where Location.Id = forms!frmloc!Id

I want the above query to be written as a pass thro sql query.

Please help

thanks
 
CS said:
I have a query which is a sqlPass through query. I want the query to
take a parameter from a form. How could i do this? An example:

This is an Access query :

Select * from Location where Location.Id = forms!frmloc!Id

I want the above query to be written as a pass thro sql query.

Please help

thanks

You have to use code to change the SQL of the query...

CurrentDB.QueryDefs("QueryName").SQL = "Select * from Location where
Location.Id = " & forms!frmloc!Id

Notice how the form reference is outside the quotes. The SQL will end up
containing the value found at the form reference instead of the actual
string "forms!frmloc!Id".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top