Results 1 to 3 of 3

Thread: Help again..

  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help again..

    I have the code below on the OnExit event of a field on a form. This asks the user for a Group#. The code works but it prompts me with the write conflict error box and it makes the user select to save the record.. Any way I can have it save with out the write conflict message. I made sure that no reports, tables, forms except the current form are open when I ran this and I still got the write conflict message. Thanks in advance.

    Private Sub txtSignedDate_Exit(Cancel As Integer)
    Dim MyDB As DAO.Database
    Dim MySet As DAO.Recordset
    Set MyDB = CurrentDb()
    Set MySet = MyDB.OpenRecordset("SELECT [Signature],[SignedDate],[SignedTime],[Group#] FROM ReceiptNumbers WHERE [Group#] = " & Me.txtGroup)
    With MySet
    Do While Not .EOF
    .Edit
    ![Signature] = Me.Signature
    ![SignedDate] = Me.txtSignedDate
    ![SignedTime] = Me.txtSignedTime
    .Update
    .MoveNext
    Loop
    End With
    MySet.Close
    Set MySet = Nothing
    Set MyDB = Nothing
    DoCmd.Save acForm, "IDC DataEntry Form"
    Me.RecordSource = BuildDataEntry()
    If Me.RecordSource = "" Then
    Cancel = True
    Exit Sub
    End If
    If Me.RecordsetClone.RecordCount = 0 Then
    MsgBox "Group # Not Found", vbExclamation + vbOKOnly, "IDC Receipt System Message"
    Cancel = True
    End If
    End Sub

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Help again..

    Your events are stepping on each other, and that's why you're getting the write conflict. If you want to change the recordsource of the form there is probably a more appropriate place to do it.

    Why are you trying to use the exit event of the control for this? Is this the last control on the form? Are you trying to log something? If you explain what the purpose is, someone can probably help you figure out a way to do it that will avoid the conflicts.
    Charlotte

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Help again..

    This is the last control on the form.. What the code does is update the current record and then using an Inputbox it prompts the user for a new groupid#.. Which is a field in a query. I'mnot trying to log anything just update the record.. Does the explain it better? The Me.RecordSource = BuildDataEntry() is module which is where the Inputbox part of the code is located. So BuildDataEntry needs to run to have the inputbox prompt the user. Should I be calling this another way? Not sure..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •