dbQSQLPassThrough

  • Thread starter Thread starter Alison
  • Start date Start date
A

Alison

Hello
Can I please get some help on the syntax for using
dbQSQLPassThrough in an event procedure where a string is
passed to my SQL server when a button is clicked, hope
that makes sense.
ta
alison
 
sorry if my question is not clear as this is new to me, I
have created the string as a variable to send to the SQL
server, I just need to put that string into the PASS
Through query. The string is made up of one or more grant
or revoke statements on different tables.
thanks much
alison
 
If you set a reference to DAO, you can open the QueryDef object and change
its SQL property.
 
sorry if my question is not clear as this is new to me, I
have created the string as a variable to send to the SQL
server, I just need to put that string into the PASS
Through query. The string is made up of one or more grant
or revoke statements on different tables.
thanks much
alison

I have never been able to find a way to pass parameters to a pass
through query. When there is no other solution, I use the following
workaround:

Set Qdf = CurrentDb.QueryDefs("ExecProc")
Qdf.SQL = "EXEC MyProc " & ParameterName
DoCmd.OpenQuery "ExecProc"
Set Qdf = Nothing

This changes the contents of the pass through query before executing
it, but leaves the ODBC connection string unchanged. In order to avoid
changing a long SQL text, I make a stored procedure on the server with
the desired SQL. This stored procedure will take a parameter. The pass
through query only has to EXECute the stored procedure.

Best, Hugo
 
Back
Top