Evaluate the Format of Text in TextBox

casey

Registered User.
Local time
Today, 22:44
Joined
Dec 5, 2000
Messages
448
Hello,

Can I evaluate the Format of the Text entered in a Textbox?

I have a search box on a form that a user can enter various information into to search on...(driver license, phone#, etc...). Because one scenario causes problems, namely license# formatted "a\-aaa\-aaa\-aaa\-aaa\-aa", contains three extaneous #'s at the end of the string, I would like to evaluate the Format of the text entered prior to searching using select case and eliminate those characters from the string. This is the only scenario that causes any problems.

I've been looking, but I can't find this.

Any direction is appreciated greatly.

Thanks.
 
I would suggest that you use a combo box to allow the user to select the type of data they wish to search, Name, SSN, Phone #, etc. Then use the after update event of the combo box to set an input mask on the text box that you are allowing the users to enter their search data into.

You can also test the data in the text box in the on click event of your command button that calls the search. That should help you validate the data that they wish to search. You can also set the focus to a specific field for searching once you know what type of data they wish to search for.

HTH
 
Why not just let users select a valid number from a combo box?
 
Thanks for your responses.

Ghudson...
How would you "test" the data, as you say? If it were possible to do so, I would know that the user is scanning a license and not searching another field. The only way to do so is by checking what kind of format the TextBox data has.

Your 1st suggestion makes sense, but it creates an extra step and although one step doesn't seem like much, I want to keep this db as "free-form" as possible and space is limited. I've designed several other db's with similar search methods and they work too well to abandon. The only issue arises when I scan in the license so I would prefer to stick w/ this way of searching.

Can you suggest anything?
 
Last edited:
Thanks for your responses folks.

I'm going to test the Len(TextString) and then use Select Case.

This may be more prone to causing unforseen hang-ups, but that's what Error handlers are for right?(joking, kind of)

Until I can find a better way.
 

Users who are viewing this thread

Back
Top Bottom