Primary Key default?

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

Guest

I need to be able to restrict what goes into the primary key as in it must
have 7 numbers or either one or two letters at the end. It is the Personal
Indentification number of a person and every person has only one number they
are all 7 numbers and either have one or two letters at the end for example
it could be like 8796589G or 7865340MH. can I put an expression or validation
in there which says the number must have 7 numerals and either one or two
Letters please. I want to stop the problem of somone leaving out one of teh
characters by accident when entering the data.
 
I need to be able to restrict what goes into the primary key as in it must
have 7 numbers or either one or two letters at the end. It is the Personal
Indentification number of a person and every person has only one number they
are all 7 numbers and either have one or two letters at the end for example
it could be like 8796589G or 7865340MH. can I put an expression or validation
in there which says the number must have 7 numerals and either one or two
Letters please. I want to stop the problem of somone leaving out one of teh
characters by accident when entering the data.

Set the input mask to 00000AA
 
Ber said:
I need to be able to restrict what goes into the primary key as in it
must have 7 numbers or either one or two letters at the end. It is
the Personal Indentification number of a person and every person has
only one number they are all 7 numbers and either have one or two
letters at the end for example it could be like 8796589G or
7865340MH. can I put an expression or validation in there which says
the number must have 7 numerals and either one or two Letters
please. I want to stop the problem of somone leaving out one of teh
characters by accident when entering the data.

Here is something to try in the Validation Rule property of the field.

Like "#######[A-Z]" Or Like "#######[A-Z][A-Z]"

If you try something like this, also add a useful text to the
validation text property.
 
I need to be able to restrict what goes into the primary key as in it
must have 7 numbers or either one or two letters at the end.

Here is something to try in theValidationRule property of the field.

Like "#######[A-Z]" Or Like "#######[A-Z][A-Z]"

What do you suppose would happen if you used an ADO connection to
insert the value "#######ZZ"?

This is one of those situations where being 'ANSI mode neutral' is
simple so why not use a pattern of

Like "[0-9][0-9][0-9][0-9][0-9][0-9][0-9][A-Z][A-Z]"

Writing it 'longhand' should prompt other questions such as, are
leading zeros are valid? e.g. should the value "0000000AA" fail the
rule?

Jamie.

--
 
Back
Top