Pass parameters to pas-through query

G

Guest

Can I create a pass through query to a SQL Server database with select
criteria htat are set when the query is run? I would presume so, but I can't
get the syntax right.
 
G

Guest

YYu can create a pass through query, and before running it assign the SQL
with the criteria, and the run the query

Function SetString()
Dim strSQL As String
strSQL = "SELECT * From MyTable Where MyField = " & MyParam
CurrentDb.QueryDefs("PassthroughQueryName").SQL = strSQL
DoCmd.OpenQuery "PassthroughQueryName"
End Sub
 

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

Top