moconnell2007
New member
- Local time
- Today, 12:47
- Joined
- Jun 3, 2008
- Messages
- 2
Hi All,
I have inherited an MS Access application recently. I have a problem with a call to a SQL Server stored procedure (from VBA in Access). The connection is established with ADO and connects to the server fine and starts running the SP. However, there is a loop in the SP (while @@fetch_status = 0) and after about 14 iterations, the running of the SP seems to halt or break out and the connection from Access closed (as per designed).
I thought that I am missing a timeout setting somewhere (either on SQL or the connection from Access, ADO) but i have tried many different settings (e.g. myConnection.CommandTimeout etc) but to no avail. The problem is that I am not seeing any error message. Just that the SP does not complete when there is > 14 items to be processed.
The SP runs ok when run through Query Analyzer, however, I have noticed when it is running that it processes and displays the first 14 "items" in the Messages pane before a slight pause and continuing on with the remainder (and subsequent pauses after this). I was wondering if the ADO connection from Access sees this pause and thinks the SP has finished??? Anybody got any ideas? Appreciate any thoughts on this. Code for connection below:
Thanks,
Mark.
Dim cnn As New ADODB.Connection
cnn.CommandTimeout = 10000
cnn.ConnectionString = "File Name=\\musnas\IT\Retail\RMS_Dev.udl;"
cnn.Open
MsgBox "Records being sent to GOLD...Click OK and wait for further instruction...."
cnn.LocalArticlemig1 -- Have also tried cnn.Execute ("exec LocalArticlemig1") but no joy!!
cnn.Close
MsgBox "Records attempted to be sent to GOLD. Please print the Local Line Status Report to confirm success"
Forms!frmArticle!lstUnmatchedStores.Requery
DoCmd.Close
I have inherited an MS Access application recently. I have a problem with a call to a SQL Server stored procedure (from VBA in Access). The connection is established with ADO and connects to the server fine and starts running the SP. However, there is a loop in the SP (while @@fetch_status = 0) and after about 14 iterations, the running of the SP seems to halt or break out and the connection from Access closed (as per designed).
I thought that I am missing a timeout setting somewhere (either on SQL or the connection from Access, ADO) but i have tried many different settings (e.g. myConnection.CommandTimeout etc) but to no avail. The problem is that I am not seeing any error message. Just that the SP does not complete when there is > 14 items to be processed.
The SP runs ok when run through Query Analyzer, however, I have noticed when it is running that it processes and displays the first 14 "items" in the Messages pane before a slight pause and continuing on with the remainder (and subsequent pauses after this). I was wondering if the ADO connection from Access sees this pause and thinks the SP has finished??? Anybody got any ideas? Appreciate any thoughts on this. Code for connection below:
Thanks,
Mark.
Dim cnn As New ADODB.Connection
cnn.CommandTimeout = 10000
cnn.ConnectionString = "File Name=\\musnas\IT\Retail\RMS_Dev.udl;"
cnn.Open
MsgBox "Records being sent to GOLD...Click OK and wait for further instruction...."
cnn.LocalArticlemig1 -- Have also tried cnn.Execute ("exec LocalArticlemig1") but no joy!!
cnn.Close
MsgBox "Records attempted to be sent to GOLD. Please print the Local Line Status Report to confirm success"
Forms!frmArticle!lstUnmatchedStores.Requery
DoCmd.Close