I am working on a piece of code that takes a bar code as input and modifies the related record. It all seemed to be working okay but I have found that if you scan the same bar code twice it gives you an error about the record not being able to be edited because someone else is editing it. It fails on rst.Update. After researching the problem I can't seem to fix it. Below is the portion of my code that I am having problems with. Any help would be greatly appreciated.
Code:
Set rst = CurrentDb.OpenRecordset("Work_Details_tbl")
rst.FindFirst "Tracking_num = " & Chr(34) & Scan & Chr(34)
If rst.NoMatch Then
MsgBox "Incorect Entry"
Else
Realqty = InputBox("Enter quantity for part # " & rst!Part_Num & " on job # " & rst!Job_Num, "Enter Quantity", rst!Part_Qty)
rst.Edit
rst!Part_Status = "Recieved"
rst!Part_Completed = DLookup("init", "Users_tbl", "IDNumber = " & Usern)
rst!Part_Comp_Date = Date
rst!Part_Qty = Realqty
rst.Update
rst.Close
Set rst = Nothing
Scan = ""
Beep
Me.BarCode.SetFocus