Pass parameters to pas-through query

  • Thread starter Thread starter Guest
  • Start date Start date
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.
 
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
 
Back
Top