Pass-through query

  • Thread starter Thread starter Kent J
  • Start date Start date
K

Kent J

Hi all,

I have a Pass-through query ("QueryGeneric") that is connected to an
Access-form. The query has the connectstring to SQL-server.

I would like a Click-button to write to this pass-through query a stored
procedure name and a parameter like "sp_test Parameter1"
...and then execute the query.

How can I do this?

Kent J.
 
Dim qdfPassthrough As DAO.QueryDef

Set qdfPassthrough = CurrentDb.QueryDefs("QueryGeneric")
qdfPassthrough.SQL = "exec sp_test " & Parameter1
qdfPassthrough.Execute


Incidentally, you shouldn't prefix your stored procedures with sp_: that has
special meaning to SQL Server.
 
Back
Top