locked
DB Timing Issue (I think) RRS feed

  • Question

  • I'm not sure which forum this belongs in, so I'll start here.

    I write a record to an Access DB and shortly thereafter try to read it back. No record is returned.

    I break @ the re-read and check Access with its IDE. No record shows. I refresh in Access and still no record.

    If I let the process run to termination (ie, back to the screen) and then attempt the re-read, the record is there (both in the application and the Access IDE).

    I seem to recall there is a 'flush' type process that can be called to write dirty buffers, but I can remember what it's called (or really if it exists or is just my Old Memorex Memory).

    Any ideas (Please don't ask for code -- its about 1000 lines .

    Roger

    Sunday, November 19, 2006 1:00 PM

Answers

  • I've seen this before when you have one process writing changes to an Access table and have another trying to read it.  I'm not sure it that matches your particular problem.  It would probably work the same way if you have a different thread in your app doing the writing.  It can take a while for the data to show up, between 6 and 10 seconds (10 years ago).

    I opened a support case about it with MSFT at the time, no help.  There's no fix other than moving to a "real" database engine like SQL server...
    Sunday, November 19, 2006 11:02 PM
    Moderator

All replies

  • Hi,


    It is very difficult to help without an example, you could at least show psuedo code.

    Here is an example from a part of code in one of my Access Databases that works fine, the record is changed immediately after the .update.

       balanceset.MoveFirst

        Do While Not balanceset.EOF
           If balanceset!Item = xOld Then
              balanceset.Edit
              balanceset!Item = xNew
              balanceset.Update
           End If
           balanceset.MoveNext
        Loop


    Sunday, November 19, 2006 1:10 PM
  • please post the code, and any error messages you may recieve
    Sunday, November 19, 2006 2:40 PM
    Moderator
  • I'm manipulating te Access DB with SQL --- not Access commands
    Sunday, November 19, 2006 6:15 PM
  • This is definetely a timing issue.

    The command I was looking for was 'AcceptChanges' -- found it in some old notes.

    But, that didn't help!

    I "solved" the problem by setting a flag and doing the processing AFTER all the first pass processing was complete.

    I would still like to know how to do this "in-line" rather than my hokum way if anyone has an answer.

    Thanks

    Roger

    Sunday, November 19, 2006 7:51 PM
  • I've seen this before when you have one process writing changes to an Access table and have another trying to read it.  I'm not sure it that matches your particular problem.  It would probably work the same way if you have a different thread in your app doing the writing.  It can take a while for the data to show up, between 6 and 10 seconds (10 years ago).

    I opened a support case about it with MSFT at the time, no help.  There's no fix other than moving to a "real" database engine like SQL server...
    Sunday, November 19, 2006 11:02 PM
    Moderator
  • I suspected as much. My code is now working because the DB is Closed and Reopened.

    10 years ???

    I know things move slowly in Washington, but 10 years ???

    I'm getting close to moving to SQL anyway (deployment reasons mostly).

    Thanks for the reply.

    Roger

    Monday, November 20, 2006 10:22 AM