Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Nov 2002
    Location
    Mt. Olive, North Carolina, USA
    Posts
    170
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Re-Edit Record (2000)

    I have a button on a form that when clicked does some appending of records. My problem is after I click the button, I tab to the combobox , I get this error when I start typing the next part number. I do not get the error everytime. I have found if I wait 1 minute before I tab to the combobox I do not get the error. The error is: The data has been changed. Another user edited this record and saved the changes before you attempted to save your changes. Re-edit record. We just hit OK and start the next record.
    Private Sub SignOut_Click()
    On Error GoTo Err_SignOut_Click
    Dim strSQL As String
    Dim strSQL1 As String
    strSQL = "UPDATE tblInventory SET tblInventory.Quan = [quan]+ forms.frmSISOAauto.[signoutquantity]WHERE (((tblInventory.JN)=forms!frmSISOAauto![jn]));"
    strSQL1 = "insert into tbltranshistory(tdate,jn,quan,sisoa) select forms!frmsisoaauto!tdate, forms!frmsisoaauto!jn, forms!frmsisoaauto!signoutquantity, forms!frmsisoaauto!sisoa;"
    Debug.Print strSQL
    DoCmd.RunSQL strSQL
    DoCmd.RunSQL strSQL1
    If DLookup("[quan]", "[tblinventory]", "[jn] =" & Chr(34) & Me!JN & Chr(34)) < 0 Then
    MsgBox ("The quantity you are signing out is Greater than the amount on hand." & Chr(13) & "The amount for this item will be set to ZERO.")
    'DoCmd.RunSQL "insert into tbltranshistory (jn, quan, sisoa, tdate) " & "select tblinventory.jn, (tblinventory.quan)*(-1), " & Chr(34) & "CompAdj" & ", forms!frmdate!tdate from tblinventory " & "where tblinventory.jn =" & Chr(34) & Me.JN & Chr(34)
    DoCmd.RunSQL "insert into tbltranshistory (jn, quan, sisoa, tdate) " & "select tblinventory.jn, (tblinventory.quan)*(-1), " & Chr(34) & "CompAdj" & Chr(34) & ", forms!frmdate!tdate from tblinventory " & "where tblinventory.jn =" & Chr(34) & Me.JN & Chr(34)
    DoCmd.RunSQL "update tblinventory set tblinventory.quan = 0 where tblinventory.jn =" & Chr(34) & Me.JN & Chr(34)
    Else
    End If
    cbxMod = Null
    quan = Null
    Exit_SignOut_Click:
    Exit Sub
    Err_SignOut_Click:
    MsgBox Err.Description
    Resume Exit_SignOut_Click
    End Sub
    Is there something that you see that I need to change or could try?
    Thanks in advance.
    John

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Re-Edit Record (2000)

    You would have to requery your form after running the SQL statements. Disadvantage is that you return to the first record, so you'd have to write extra code to activate the correct record again.

  3. #3
    2 Star Lounger
    Join Date
    Nov 2002
    Location
    Mt. Olive, North Carolina, USA
    Posts
    170
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Re: Re-Edit Record (2000)

    It will be next week before we have any more records to put in. I will make the changes and let you know what happens.
    Thanks.

Posting Permissions

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