calling a sqlserver sproc from access

  • Thread starter Thread starter Phil Hellmuth
  • Start date Start date
P

Phil Hellmuth

How would I write code to call a sproc from SQLServer? I connect to SQL
via ODBC. So, let's say the sproc is named sp_test, and my ODBC DSN is
'ABC'.

Thanks in advance.
 
Hi,
you need to create a pass-through query with sql:
sp_test
and connection string to your database.
then run this query as any access query

or you can use following code:

Dim qryd As QueryDef
Set qryd = currentdb.CreateQueryDef("")
qryd.Connect = "ODBC;..." 'copy it from above query connect string
qryd.SQL = "sp_test"
qryd.ReturnsRecords = false
qryd.Execute


--
Best regards,
___________
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com
 

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

Back
Top