Pass-through query

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.
 
D

Douglas J. Steele

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.
 

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