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!

adodb.command

Status
Not open for further replies.

OhioSteve

MIS
Mar 12, 2002
1,352
0
0
US
I have an Access db on several users' laptops. This Access db can upload records to an sql server db. To perform the upload, I used an adodb.connection and an adodb.command.

When the command.execute method fires, sql server ALWAYS gets the data and does the insert. However, SOMETIMES the vba function stops running right on the command.execute line. Eventually, the command.execute times out and reports an error- even though the insert actually worked.

Here are a couple of fixes that I am considering:

1. I use the same command object repeatedly. I just change the parameters and call .execute again. Perhaps I should instantiate a new command EVERY single time. This would be ineficient but I am moving a tiny amount of data, so efficiency is not a key concern.

2. Perhaps I should make the command run asynchronously. Here is the syntax I am considering:
myCommand.Execute , , adAsyncExecute

Are those good ideas? I look forward to your feedback.
 
Or maybe I need to do this instead:

With myCommand
.ActiveConnection.BeginTrans
.Execute
.ActiveConnection.CommitTrans
End With

Would that force it to finish?
 
Steve,

BeginTrans-CommitTrans-RollBackTrans apply to connection objects and not on commands

Maybe you should check the ExecuteComplete Event. But it wont work if you execute the command adAsyncExecute
 
Meghan, the error is "timeout expired". It is weird because the call to the stored procedue DOES happen, and SQL Server inserts the data. Yet on the Access side the call times out.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top