Validation rules for partial # 's

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

Guest

I am developing a multi purpose database....
this really isnt important though..

What i am trying to figure out is whether or not I can have some sort of
credit card verification......

one of my forms requires a client identity to be generated... a portion of
this requires a credit card number to be entered... at times, employees enter
bogus #'s because they have forgotten to take down a correct #...

What I would like to do is have the credit card feild require a 4 or 5 as
the first digit....

The feild is currently running with a mask that looks like:

****/****/****/****

I would like the first character to be a 4 or a 5 or return an error message.

Is this possible?
It is not a huge issue from my p.o.v..... however a few of the individuals
who will be using this DB have asked me to look into this issue.
 
On the before update event of the field, you can check the value of the first
digit, and return an error if its different then 4 or 5

Dim MyInt as Integer
MyInt = Left(Me.FieldName,1)
If MyInt <> 4 and MyInt <> 5 then
msgbox "Must be 4 or 5"
cancel = True 'wont update the field
end if
 
You could do it in code, as suggested elsewhere in this thread.
Alternatively you could do it with a table-level (not field-level)
validation rule, something like this ...

Left$([CreditCardNum] & "",1)="4" Or Left$([CreditCardNum] & "",1)="5" Or
[CreditCardNum] Is Null

To create a table-level validation rule, open the table in design view and
select Properties from the View menu.
 
I have decieded to simplify this....

Instead of running verification on the actual #... I am simply going to
request that the exp date is at least current.

If I have a feild formatted like "00/00;0;" how can I create a verification
that ensures the exp date is greater or equal to the current date?
Now() works... but only if the exp date is entered as a complete date... credit card exp's are entered 00/00

I need the verification rule to retrieve the current date, change it to a
00/00 (month / yr) format, and then check it against the exp date that is
entered.

Any ideas?

Brendan Reynolds said:
You could do it in code, as suggested elsewhere in this thread.
Alternatively you could do it with a table-level (not field-level)
validation rule, something like this ...

Left$([CreditCardNum] & "",1)="4" Or Left$([CreditCardNum] & "",1)="5" Or
[CreditCardNum] Is Null

To create a table-level validation rule, open the table in design view and
select Properties from the View menu.

--
Brendan Reynolds


Trial & Error said:
I am developing a multi purpose database....
this really isnt important though..

What i am trying to figure out is whether or not I can have some sort of
credit card verification......

one of my forms requires a client identity to be generated... a portion of
this requires a credit card number to be entered... at times, employees
enter
bogus #'s because they have forgotten to take down a correct #...

What I would like to do is have the credit card feild require a 4 or 5 as
the first digit....

The feild is currently running with a mask that looks like:

****/****/****/****

I would like the first character to be a 4 or a 5 or return an error
message.

Is this possible?
It is not a huge issue from my p.o.v..... however a few of the individuals
who will be using this DB have asked me to look into this issue.
 
Back
Top