Hope someone can help with this.
I have the following code in the beforeupdate event of a text box on a form
Dim response As Integer
Select Case Me.SupplierAdd1()
Case "y"
MsgBox "New record added", vbOKOnly
Case "n"
response = MsgBox("Are you sure you want to delete this record", vbYesNo)
If response = vbYes Then
'Cancel = True
Me.Undo
MsgBox "Record Deleted", vbOKOnly
(want to set focus to another control here)
End If
If response = vbNo Then
Cancel = True
End If
Case "D"
DoCmd.OpenForm "FrmDeliveryAddress"
Case Else
MsgBox "Y or N only", vbOKOnly
Cancel = True
End Select
What im having trouble with is that if i try to setfocus to a control in the highlighted area it wont let me and gives me an error saying :
Run-time error '2108'
you must save the field before you execute the gotocontrol action, the gotocontrol method, or the setfocus method.
I have also tried adding the line to the afterupdate event of the form and the control with no success.
Any help will be much appreciated.
Thanks
Gareth
I have the following code in the beforeupdate event of a text box on a form
Dim response As Integer
Select Case Me.SupplierAdd1()
Case "y"
MsgBox "New record added", vbOKOnly
Case "n"
response = MsgBox("Are you sure you want to delete this record", vbYesNo)
If response = vbYes Then
'Cancel = True
Me.Undo
MsgBox "Record Deleted", vbOKOnly
(want to set focus to another control here)
End If
If response = vbNo Then
Cancel = True
End If
Case "D"
DoCmd.OpenForm "FrmDeliveryAddress"
Case Else
MsgBox "Y or N only", vbOKOnly
Cancel = True
End Select
What im having trouble with is that if i try to setfocus to a control in the highlighted area it wont let me and gives me an error saying :
Run-time error '2108'
you must save the field before you execute the gotocontrol action, the gotocontrol method, or the setfocus method.
I have also tried adding the line to the afterupdate event of the form and the control with no success.
Any help will be much appreciated.
Thanks
Gareth