Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use SQL Stored Procedure as source for non-ADP Report? 1

Status
Not open for further replies.

HowieG

Programmer
Oct 12, 2001
64
0
0
CA
Can you use a SQL server stored procedure (uses one parameter) as the record source for a MDB (non-ADP) Access Report?

Thanks,
Rob
 
Sort of... What you could do is make an SQL Pass Thru (SPT)query that runs the stored procedure with a parameter specified and make it the recordsource of your report. Finally when you open the report (presumably a button click event) you can modify the SQL property of the SPT Query to change the call (I would just set the entire statemnet).

Code:
Dim qry as dao.querydef

Set Qry = currentdb.queries("SPT Query Name")

qry.SQL = "procname (" & Variable & ")"
qry.close
set qry = nothing

docmd.openreport "ReportName"
 
Great! That works.

(Except it's querydef, not queries)

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top