Wait Until Database Tables Have Updated (DAO)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form on which a button press initiates a process of finding duplicate records across several tables. A table in the current database is first emptied of records and then populated with new records as duplicates are found, using syntax of the form:
tbl.Edit
tbl!<Fieldname> = Value
tbl.Update
When the process is complete, a couple of buttons on the form are enabled to allow viewing of the duplicates table that has been built. If I click the button to view the table too soon, I am shown a table with no records. If I close the table and click the button again (or wait a few seconds before clicking the first time), I am shown the fully populated table. Is there any way in DAO to force the table to complete its updates before displaying it, or failing that is there any way to determine if a table still has updates waiting to be completed?

Thanks in advance for any assistance!
Mike
 
If you do this in a Transaction, there is a dbFlushCache option (I think I
spelled it correctly). The help file will have more information, but you can
force the cache to be written to disk.

--
Wayne Morgan
Microsoft Access MVP


Mike said:
I have a form on which a button press initiates a process of finding
duplicate records across several tables. A table in the current database is
first emptied of records and then populated with new records as duplicates
are found, using syntax of the form:
tbl.Edit
tbl!<Fieldname> = Value
tbl.Update
When the process is complete, a couple of buttons on the form are enabled
to allow viewing of the duplicates table that has been built. If I click
the button to view the table too soon, I am shown a table with no records.
If I close the table and click the button again (or wait a few seconds
before clicking the first time), I am shown the fully populated table. Is
there any way in DAO to force the table to complete its updates before
displaying it, or failing that is there any way to determine if a table
still has updates waiting to be completed?
 
In fact, I found that I didn't even have to put the actual updates within the transaction, but I simply include the following two lines of code at the bottom of my subroutine right before returning control to the user
BeginTran
CommitTrans dbForceOSFlus

Now that's a nice couple of lines of code to hold onto!! Thanks again for your expert assistance.
 
Mike said:
In fact, I found that I didn't even have to put the actual updates
within the transaction, but I simply include the following two
lines of code at the bottom of my subroutine right before
returning control to the user: BeginTrans CommitTrans dbForceOSFlush

Now that's a nice couple of lines of code to hold onto!! Thanks
again for your expert assistance.

You might also see if the one line

DBEngine.Idle dbRefreshCache

does the job.
 
Back
Top