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!

Writing to MS Access database

Status
Not open for further replies.

AOLBoy

IS-IT--Management
May 7, 2002
68
0
0
GB
I have a VB6 application that uses ADO to write to an MS Access database, via an ODBC link. I am writing entries to a log file in Access depending on events happening in my application.

My problem is that the process works fine in debug mode, but in normal mode it doesn't always write the records. Should I be putting in something to slow it down like a wait or something, or there a magic answer.

Any suggestions would be most welcome, thanks.
 
Doevents - the wait command you're asking about. Place directly after the command you need to complete before the application moves on.

There should not be any differences, but with out more information, i offer much more.

"If I were to wake up with my head sewn to the carpet, I wouldn't be more surprised than I am right now.
 
I very much doubt that you need to do anything with DoEvents.

You will need to post the code you use to insert the record before you can get any useful answer. Otherwise we have no way of knowing what is wrong.


 
I agree Joe. DoEvents is not likely the answer he is looking for. I only use it to allow the screen to refresh and paint when in a hard loop.

"If I were to wake up with my head sewn to the carpet, I wouldn't be more surprised than I am right now.
 
Don't know how "magic" it is but you might try using transactions
Code:
Dim cn As New ADODB.Connection
cn.Open <SomeConnectionString>
cn.BeginTrans

' Write some stuff to the Database

cn.CommitTrans

BeginTrans ... CommitTrans will force buffers to be flushed and the database to be updated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top