Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text validation

Status
Not open for further replies.

DeepBlerg

Technical User
Jan 13, 2001
224
AU
I need to do some text validation before data can be entered to the mdb.

First type of validation is:
currency - needs to check if the format is (whatever).##

and Second type of validation is:
date - needs to check if format is dd mmm yyyy

how would i go about coding those text buttons to validate user input?

Thanks.
 
In general, validation routines are simpile comparisions to masks. They are generally placed ina before_Update event of the specific control. On failure, focus is set back to the control. Often, the offending enrtry is blanked, although other approaches are also seen.

For your currency check, you can check IsNumeric to asure that the entry is at least recognizable as a number. Beyond that, you can check if it lies within a 'reasonable' range (if you can define reasonable).

For the date format shown, I can only suggest that yoyusplit each of the parts, construct a "date" from them as a date type variable. If that fails, it must NOT be a date, so it is not valid. If you can construct a date, then creeate a string variable using the format function and compare it to the date entered. If they match, it is valid, else it is not valid. Here, you also need to be careful of "Case".


MichaelRed
redmsp@erols.com

There is never time to do it right but there is always time to do it over
 
If you're just interested in compairing what's entered to those formats I'd suggest looking into the like command. If you want to make the entered data match those inputs look into format.

-Sean
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top