SQL Server Stored procedures

  • Thread starter Thread starter Daniel
  • Start date Start date
D

Daniel

Hi,
Is there a way of passing parameters to SQL server stored
procedure from Access (XP) at runtime ?

Thanx in advance
 
You can create a pass-through query, and change its SQL property to reflect
the parameter values. Access can't do this automatically for you, though:
you must use VBA code to do it.
 
Thanx for your answer,

I need a bit more information: what's a "pass-through"
query and if you can give a small example it would help a
lot.

Daniel
 
You can create a new query and don't select any tables. View the SQL View
and then select Query|SQL Specific|Pass-Through. You can then use the
builder to create or select a ODBC/DSN to connect to your SQL Server. Set
the SQL to execute your stored procedure ie:
EXEC spYourProc '1/1/2003', 3
Save the query with a name like "qsptMyPT"
You can then use DAO code to change the SQL property of the query:
CurrentDb.QueryDefs("qsptMyPT").SQL = "EXEC spYourProc '" & Me.txtDate &
"', " & Me.EmpID
 
Back
Top