Validation of Field

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi everyone,
I am working on a credit card receiving screen and wanted to know if there
was a way to run a date verification against a text field? I am capturing
the expiration date in a text field as I need the format to be mmyy for
processing purposes and need the "0" to stay in the field if say the month is
05 (May) - I would now like to add a check to make sure the expiration date
entered is >= todays date. I tried using the validation rule, but could not
find out how to format now() to the format of mmyy - any thoughts?
Thank you!
 
Try Format(Date,"mmyy")

Gary said:
Hi everyone,
I am working on a credit card receiving screen and wanted to know if there
was a way to run a date verification against a text field? I am capturing
the expiration date in a text field as I need the format to be mmyy for
processing purposes and need the "0" to stay in the field if say the month is
05 (May) - I would now like to add a check to make sure the expiration date
entered is >= todays date. I tried using the validation rule, but could not
find out how to format now() to the format of mmyy - any thoughts?
Thank you!
 
Hi,
Thanks for the reply. I tried putting this in the Validation Rule:
=Format("date","mmyy")
Access puts the " around date...
but it pops up as a validation regardless of the expiration date I put in.
(I tried 1005 and 1006 and each showed the message)
Thoughts? Thanks!
-gary
 
If this check is in a form, presumably you are entering the expiration
in a text box. You may have to use VB to do the check in an After Update
procedure, and force the text box contents to a string which is compared
with the date:

format(me!ExpDate,"0000") >= Format(date,"mmyy")

Even though you enter 0609, for example, in the text box, you cannot be
sure what Access does with that in a validation. It might convert what
it thinks is a number to a string, but without the leading zeros.

John
 

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

Back
Top