• Acc 2K Doing weird things (Acc 2K Jet4 SP5)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Acc 2K Doing weird things (Acc 2K Jet4 SP5)

    Author
    Topic
    #361922

    I got lost in your currents, but the current event happens fairly often–when you first open a form, every time you move between records, every time you requery the form, every time you update a record, every time the form gets the focus, etc. Using recordsetclone navigation in the current event may be what’s causing your weird behavior, since it’s recursive in that it should trigger the current event again.

    Viewing 2 reply threads
    Author
    Replies
    • #548613

      HI Charlotte,

      Thanks for the comments. I completely agree with you. I also apologise for it being hard to follow.

      I guess the 2 points that I make are

      1. Notce in the table of records that I presented the CurrentFinish string is written to the table two records in a row

      2. If the OnCurrent event was firing twice in a row, it would still have to run through the sections of the OnCurrent Event that write Current, Current2, Current3 to the table before it could write CurrentFinish. It doesn’t perform the parts of the OnCurrent Event that it should prior to the ‘CurrentFinish’ stage.

      Cheers

      Jayden

    • #548496

      Hi

      This one has me stumped. To cut a long story short, I am having locking issues in an Access database that two users are using at the same time. I can’t seem to find the reason that records are locking, there don’t seem to be any places where they should be being locked. Investigating this problem led me to look at what is happening during the OnCurrent and BeforeUpdate events of the data entry form.

      The databases that users are using are distributed MDE files (with linked tables back to a central .mdb file).

      In order to try and figure out what is happening between the both of them, at various stages during the OnCurrent and BeforeUpdate routines, I write information to table to try and track where each user is at when the locking occurs.

      I’ve noticed however that Access is ‘repeating’ parts of code that are NOT part of a loop (without repeating the parts of code the preceed them. Here is some output from the table that I am writing to.

      Only one user (charlotteb) is logged into the database when this is happening.

      User Position TimeStamp Order
      CharlotteB CurrentFinish 25/10/2001 17:02:21 31209
      CharlotteB CurrentFinish 25/10/2001 17:02:21 31208
      CharlotteB Current3 25/10/2001 17:02:21 31207
      CharlotteB Current2 25/10/2001 17:02:21 31206
      CharlotteB Current 25/10/2001 17:02:21 31205

      This table is showing the output from a function in reverse order (ie. the most recent event at the top).
      Notice how the ‘CurrentFinish’ output follows itself twice (without the Current1, 2, 3 etc).
      Next I will paste the event subroutine that is writing to the table
      ———————————————————————————————————-
      Private Sub Form_Current()
      Dim tempRecBookmark As Long

      DebugLog “Current” ‘Degugger for LockedRecords

      If IsNull(Me![cboProviderID]) Then
      bExistingRecord = False
      ‘Me![cboProviderID].Locked = False
      Else
      bExistingRecord = True
      ‘Me![cboProviderID].Locked = True
      End If

      DebugLog “Current2” ‘Degugger for LockedRecords

      If IsNull(Me![cboDisallowedReason]) Then
      Me![txtPSDate].Visible = False
      Else
      Me![txtPSDate].Visible = True
      End If

      DebugLog “Current3” ‘Degugger for LockedRecords

      ‘ this is for going back to the disallowed claim that you just entered
      ‘ in the beforeUpdate event of the form, assign the [claimID] to lngdisallowRecID
      If lngdisallowRecID 0 Then
      DebugLog “Current4” ‘De###### for LockedRecords
      tempRecBookmark = lngdisallowRecID
      lngdisallowRecID = 0
      Me.RecordsetClone.FindFirst “[ClaimID] = ” & tempRecBookmark
      Me.Bookmark = Me.RecordsetClone.Bookmark
      End If

      DebugLog “CurrentFinish” ‘Degugger for LockedRecords
      End Sub
      ——————————————————————————————————-

      At various points in the subroutine, you will notice that the subroutine calls a function ‘DebugLog’ and passes a string variable. This function writes one line (using DAO) to the table shown above.

      Note how it is theoretically impossible for the line ‘CurrentFinish’ to be written twice in a row.

      I have no answers for this – and I suspect that Access is doing something that it shouldn’t be. Has anyone got any insight, or experienced something similar?

      Your help or opinions are much appreciated.

      Cheers

      Jayden
      Access 2000 SR-2
      Jet4 SP5

    • #548624

      Yay,

      Your comments got me thinking (especially about the Recordsetclone causing the Current Event to fire)…so I then found the problem / cause of my query, thanks. It is certainly the Recordsetclone that is causing Access to run the Current Event again, then return to the place where it left off (thereby giving the double ‘CurrentFinish’). This may certainly explain some of the record locking issues.

      You’ve been a great help, thanks.

      PS: I would never have though that Access would ‘nest’ a Current Event within another Current Event so to speak….don’t we learn something everyday!

      Cheers

      Jayden

    Viewing 2 reply threads
    Reply To: Acc 2K Doing weird things (Acc 2K Jet4 SP5)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: