Access 2007
Hi All,
I have the code below that runs a stored procedure on an SQL 2008 database from Access.
This bit works great and the stored procedure runs, but now I would like to use the results from the stored procedure in the Access database.
I am stuck at what to add to this VBA code to capture the results and use them in the Access db.
Any assistance in the correct direction greatly appreciated.
Regards,
Michael
Hi All,
I have the code below that runs a stored procedure on an SQL 2008 database from Access.
This bit works great and the stored procedure runs, but now I would like to use the results from the stored procedure in the Access database.
I am stuck at what to add to this VBA code to capture the results and use them in the Access db.
Code:
DoCmd.Hourglass True
Dim strConnect As String
Dim strSQL As String
Dim dbs As Database
Dim qdf As QueryDef
Dim strErrMsg As String
Set dbs = CurrentDb
strConnect = "ODBC;DSN=******;UID=***;PWD=****;"
Set qdf = dbs.CreateQueryDef("")
qdf.Connect = strConnect
strSQL = "exec test_proc" 'name of procedure here
qdf.ReturnsRecords = True
qdf.SQL = strSQL
dbs.QueryTimeout = 2000 'Set timeout to 4 minutes so it doesn't timeout.
qdf.ODBCTimeout = 1000
qdf.Execute
DoCmd.Hourglass False
Any assistance in the correct direction greatly appreciated.
Regards,
Michael