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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data Type Check

Status
Not open for further replies.

mans

Programmer
Mar 18, 2000
136
0
0
AU
Hello,

I am using VB6 with Access2000. Can somebody please let me know what code I need to use to check the data type in a text box. I would like a message box to come up and tell the user that he/she has entered:

1/ text instead of a numerical value
2/ a numerical value instead of a date/time
3/ text instead of a date/time

I am OK with the message box part but what code do I need to run to test for each of the 3 situations above.

Thank You
 
Look up the Isdate function and the IsNumeric function in VBHelp.

IsDate returns Boolean True if the string passed can be interpreted as a date.

IsNumeric returns Boolean True if the string passed can be interpreted as a number. Let me know if this helps
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'There are 10 kinds of people in the world: those who understand binary, and those who don't.'
 
Also, you could use the MaskEdit box, or something like under Thread222-363768, allowing only numeric input into the text box in the first place, or, as in the date input, checking the key strokes to allow only certain characters to be entered, and in doing so, avoiding alot a aggravating message boxes. [/b][/i][/u][sub]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top