BarryMK
4 strings are enough
- Local time
- Today, 03:05
- Joined
- Oct 15, 2002
- Messages
- 1,350
The following code was fine in 97 but falls over in 2003 at the Undo command shown in red font. I get Undo not Available error
I've tried Me.Undo, Docmd.CancelEvent, Cancel =True. Any other ideas?
Private Sub cmdMove_Click()
On Error GoTo Err_cmdMove_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmOwnerDetails"
stLinkCriteria = "[DogNumber]=" & Me![DogNumber]
'error check
If IsNull(Me.txtDogName) Then
MsgBox "Please get the dog's name and enter it. This will help the wardens if the dog is seized again", vbInformation, "Field cannot be left blank"
DoCmd.Undo
Me.cmdClose.SetFocus
End If
If IsNull(Me![StrayRef]) Then
MsgBox "Please select a dog from the list", vbInformation, "User error"
Else
'minimise current form
DoCmd.Close
DoCmd.OpenForm stDocName, , , stLinkCriteria
stLinkCriteria = "[DogNumber]=" & Me![DogNumber]
End If
Exit_cmdMove_Click:
Exit Sub
Err_cmdMove_Click:
Resume Exit_cmdMove_Click
End Sub
I've tried Me.Undo, Docmd.CancelEvent, Cancel =True. Any other ideas?
Private Sub cmdMove_Click()
On Error GoTo Err_cmdMove_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmOwnerDetails"
stLinkCriteria = "[DogNumber]=" & Me![DogNumber]
'error check
If IsNull(Me.txtDogName) Then
MsgBox "Please get the dog's name and enter it. This will help the wardens if the dog is seized again", vbInformation, "Field cannot be left blank"
DoCmd.Undo
Me.cmdClose.SetFocus
End If
If IsNull(Me![StrayRef]) Then
MsgBox "Please select a dog from the list", vbInformation, "User error"
Else
'minimise current form
DoCmd.Close
DoCmd.OpenForm stDocName, , , stLinkCriteria
stLinkCriteria = "[DogNumber]=" & Me![DogNumber]
End If
Exit_cmdMove_Click:
Exit Sub
Err_cmdMove_Click:
Resume Exit_cmdMove_Click
End Sub