If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
How to check whether the value in text field is Date type
Hi,
I ahve a text box. How can I check if the value in the textbox is a date. I want a user to only put in a date. I use the date selector (calendar). But user can still type in text. I use Access 2007 Thanks, Boon |
#2
|
|||
|
|||
How to check whether the value in text field is Date type
"Boon" wrote in message
... Hi, I ahve a text box. How can I check if the value in the textbox is a date. I want a user to only put in a date. I use the date selector (calendar). But user can still type in text. I use Access 2007 If you set the Format property of the text box to one of the date formats (e.g., "Short Date"), the user will only be able to enter values that can be converted to dates. Or, if this is a bound control, if the underlying field is a Date/Time field, the user won't be able to enter any non-date value. Null values are still okay, in these cases. The text box must be unformatted and unbound, you can use the IsDate() function to determine whether the value can be interpreted as a date: If IsDate(Me.txtDateEntered) Then ' This is a date value Else ' It's null or a non-date. End If Note that all of these approaches allow the user to enter something like "January 1", because Access can interpret that as a date. -- Dirk Goldgar, MS Access MVP Access tips: www.datagnostics.com/tips.html (please reply to the newsgroup) |
Thread Tools | |
Display Modes | |
|
|