Here's the code;
Private Sub txtTeachName_LostFocus()
If IsNull(Me.txtName) Then 'line A
Forms!frmMainform!frmSubform.Locked = True
GoTo Exit_txtName
Else 'line B
Forms!frmMainform!frmSubform.Locked = False 'line C
If IsEmpty(oldName) Then
oldName = Me.Name
GoTo Exit_txtName
End If
End If
Exit_txtName:
Exit Sub
End Sub
If txtName isn't a null then I see the code jump to Else (the line marked B)
and then jump back to the first If - i.e it doesn't run the code after the
Else statement.
This happens around 25 times then finally the pointer moves on and finally
reaches the Exit Sub at the end.
However it does NOT exit the code as I would expect but instead moves to the
line marked C. It then moves to A. This second loop keeps going for quite
a while and I'm still stepping through it as I write.
I really have no idea why this is happening - I can only assume it's caused
by some weird combination of events, yet I am stepping through everything
and only the lostfocus event is firing.
Any ideas?
thanks
Martin