Validating Unbound textbox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an unbound input text box for entering a user extension number.

Two thing are required

1- The text box must no be left blank.
2- Lookup the extension number from the Operator's table if one is available
and store to the text box.
Note the forn is attached to a guery call qryOperators.
 
Use the After_Update() event of the message box to validate the value in the
text box. If the value fails your validation tests then use the ".SetFocus"
method to put focus back to your text box.

e.g.

Sub MyTextBox_After_Update()
If me.mytextbox.value = "" or isnull(me.mytextbox.value) then
msgbox "Fails validation"
me.mytextbox.setfocus
else
' whatever you want to do if it passes inspection
End if
End Sub

Hope that helps. (note the code is off the top of my head, so you may have
to adjust for syntax)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top