VBA code a text box for dynamic length

  • Thread starter Thread starter pfm721
  • Start date Start date
P

pfm721

I have a text box tbConsultNumber. My Company recently decided it wanted to
accept authorization numbers in that spot as well. Consult numbers are 7
characters and Authorization numbers are 9 characters with the following
format 0000000-0. What I want to do is check the data in the text box to make
sure that it matches one of the two requirements and if it doesn't display a
msg box to let the user know to check the number and enter one in the valid
format.

Thanks in advance for any help.
 
pfm721 said:
I have a text box tbConsultNumber. My Company recently decided it wanted to
accept authorization numbers in that spot as well. Consult numbers are 7
characters and Authorization numbers are 9 characters with the following
format 0000000-0. What I want to do is check the data in the text box to
make
sure that it matches one of the two requirements and if it doesn't display
a
msg box to let the user know to check the number and enter one in the
valid
format.

Thanks in advance for any help.

IF LEN(textbox) <> 7 AND LEN(textbox) <> 9 THEN
MSGBOX.............
END IF
 

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

Similar Threads


Back
Top