calling a sqlserver sproc from access

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

Alex Dybenko

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
 
Top