I have a data entry form where the first text box has the following code:
If gbl_Switch = 1 Then
Exit Sub
Else
End If
If Trim(Me.ID_Number & " ") = "" Then
MsgBox "Click OK, then enter an ID Number"
ID_Number.SetFocus
Exit Sub
Else
End If
Other code follows.
This bit makes sure that the user enters something into the box, which is what we want.
However, there are buttons on this form that open other forms, but the user is now trapped in the text box.
I have tried creating code in one of those buttons that sets a switch(Invisible textbox) to 1 on click, but the button does not set the switch on click, and does not open the other form, but the user is still trapped.
I get around this by removing the first bit of code from the inital textbox, and just check for blank entry then setfocus to the next textbox. Then I can use the buttons. But this is not spiffing. So the question is, can I trap the onlostfocus event, or is ther another way of doing this.
Any help or suggestions would be welcome.
jpl
If gbl_Switch = 1 Then
Exit Sub
Else
End If
If Trim(Me.ID_Number & " ") = "" Then
MsgBox "Click OK, then enter an ID Number"
ID_Number.SetFocus
Exit Sub
Else
End If
Other code follows.
This bit makes sure that the user enters something into the box, which is what we want.
However, there are buttons on this form that open other forms, but the user is now trapped in the text box.
I have tried creating code in one of those buttons that sets a switch(Invisible textbox) to 1 on click, but the button does not set the switch on click, and does not open the other form, but the user is still trapped.
I get around this by removing the first bit of code from the inital textbox, and just check for blank entry then setfocus to the next textbox. Then I can use the buttons. But this is not spiffing. So the question is, can I trap the onlostfocus event, or is ther another way of doing this.
Any help or suggestions would be welcome.
jpl