Hi All,
I have a form "FormKC"with a textbox "BoxNo". The user scans a barcode and the text and the afterupdate code runs a query in which the user name and scanned data is appended by the query to a table. The text is then set to " " (erased) and the process designed to continue...but every time I go to repeat the process, upon scanning, the form closes down. Can't see why. I have attached the code (has warning suppressors)
Code:
Private Sub BoxNo_AfterUpdate()
On Error GoTo ErrorHandler
DoCmd.SetWarnings False
DoCmd.Hourglass True
DoCmd.OpenQuery "QryAllocateKC"
BoxNo.Value = ""
Me.Refresh
Exit_Handler:
DoCmd.SetWarnings True
DoCmd.Hourglass False
Exit Sub
ErrorHandler:
Select Case Err
Case 2051
'do nothing
Case Else
MsgBox "An error was encountered" & vbCrLf & vbCrLf & _
"Description: " & Err.Description & vbCrLf & _
"Error Number: " & Err.Number, , "Error"
End Select
End Sub
Can anyone see what would make the form close?
Many thanks,
M