Hello everyone. I thank you in advance for your time.
I think I have a little bit too much stuff in my code. I want an error message to pop up if the Carton Count or CBM is out of balance. Here is the code:
The first half and second half of the code work if I have them seperately. The problem comes when I am trying to combine them. I have tried pulling out various commands when I get error messages but I'm not sure exactly what I am doing wrong.
As always your thoughts are most welcome.
Thanks
Eddie.
I think I have a little bit too much stuff in my code. I want an error message to pop up if the Carton Count or CBM is out of balance. Here is the code:
Code:
Private Sub AddRecord_Click()
On Error GoTo Err_AddRecord_Click
If (Me.Cartons - Me.Text31) = 0 Then
DoCmd.GoToRecord , , acNewRec
Else
MsgBox "Carton count out of balance"
End If
Err_AddRecord_Click:
MsgBox Err.Description
Resume Exit_AddRecord_Click
If (Me.Text69 - Me.Text78) = 0 Then
DoCmd.GoToRecord , , acNewRec
Else
MsgBox "CBM out of balance"
End If
Exit_AddRecord_Click:
Exit Sub
Err_AddRecord_Click:
MsgBox Err.Description
Resume Exit_AddRecord_Click
End Sub
The first half and second half of the code work if I have them seperately. The problem comes when I am trying to combine them. I have tried pulling out various commands when I get error messages but I'm not sure exactly what I am doing wrong.
As always your thoughts are most welcome.
Thanks
Eddie.