Hi all

I have created a "Before Update" event procedure in Visual Basic. The event procedure is in the first field of each Input form. I created it in the Customer Input form first and it works fine. I then created an event procedure in my Employee input form but for some reason after click 'Ok' on the second message box it throws up this Error: 'Runtime error 2108' "You must save the field before you execute the GoToControl action, the GoToControl method, or the SetFocus method"

The code in the Employee form is exactly the same (Apart from the header which designates which form it is for) as the Customers form but throws that error. Does anyone know why, or how to fix it? I have tried a number of things, none of them successful to the point where the form is usable in a business environment. Below is the code I have used:

(A Note: The bit that is highlighted seems to be the issue, but if its taken out then the sub won't return the user to the control that needs data in it upon clicking ok to the message "Please fill in field")

Private Sub Employee_Name_BeforeUpdate(Cancel As Integer)

'Purpose of Sub: VB function to check that each field has data in it'

Dim oContr As Control
Dim iResponse As String
For Each oContr In Me.Detail.Controls

'If parameter'
If IsNull(oContr) Then
'Message to pop up if field is empty'
iResponse = MsgBox(oContr.Name & " field has not been entered! Save anyway?", Buttons:=vbYesNo)
'If answer is no then pop up request asking user to fill in field'
If iResponse = vbNo Then
Cancel = True
MsgBox "Please fill in field"
oContr.SetFocus: Exit Sub

'If answer is yes then save form and check the next field. Process will repeat from here'

End If
End If
Next oContr
End Sub

Many thanks for your help