peterbowles
Registered User.
- Local time
- Today, 16:27
- Joined
- Oct 11, 2002
- Messages
- 163
I use the following code in the on_Click event of a button
Private Sub cmdsave_Click()
If IsNull(Me.BillRefNumber) = True Then
MsgBox "Please Enter a customer number"
Me.BillRefNumber.SetFocus
Else
If IsNull(Me.AccomID) = True Then
MsgBox "Please select customer accommodation type"
Me.AccomID.SetFocus
Me.AccomID.Dropdown
Else
On Error GoTo errno- On this part I want to stop going through the rest of the code until there is no error.
MsgBox "Bill Ref No (" & Me.BillRefNumber & ") has been added/amended"
Me.Label55.Visible = True
Me.AllowEdits = False
Me.AllowAdditions = False
Me.Requery
Me.Refresh
DoCmd.ShowAllRecords
Me.Label55.Visible = True
End If
End If
Exit Sub
errno:
MsgBox "This record could not be added as there are duplicate Bill Ref No."
End Sub
Private Sub cmdsave_Click()
If IsNull(Me.BillRefNumber) = True Then
MsgBox "Please Enter a customer number"
Me.BillRefNumber.SetFocus
Else
If IsNull(Me.AccomID) = True Then
MsgBox "Please select customer accommodation type"
Me.AccomID.SetFocus
Me.AccomID.Dropdown
Else
On Error GoTo errno- On this part I want to stop going through the rest of the code until there is no error.
MsgBox "Bill Ref No (" & Me.BillRefNumber & ") has been added/amended"
Me.Label55.Visible = True
Me.AllowEdits = False
Me.AllowAdditions = False
Me.Requery
Me.Refresh
DoCmd.ShowAllRecords
Me.Label55.Visible = True
End If
End If
Exit Sub
errno:
MsgBox "This record could not be added as there are duplicate Bill Ref No."
End Sub