Please help with Validation rule

S

Skully Matjas

I want to set a validation rule that a field cant have the same number
as another entery for the same field.
I want it to do this when i am entering it into a form, so if it is a
duplicate it would tell me that.

The form and table name iS: "Ralphs cards" the field is called "Ralphs#"
 
J

John Vinson

I want to set a validation rule that a field cant have the same number
as another entery for the same field.
I want it to do this when i am entering it into a form, so if it is a
duplicate it would tell me that.

The form and table name iS: "Ralphs cards" the field is called "Ralphs#"

Simply make [Ralphs#] the Primary Key of the table, or create a unique
Index on the field. A validation rule isn't the right place to do
this.
 
S

Skully Matjas

I want to set a validation rule that a field cant have the same number
as another entery for the same field.
I want it to do this when i am entering it into a form, so if it is a
duplicate it would tell me that.

The form and table name iS: "Ralphs cards" the field is called
"Ralphs#"

Simply make [Ralphs#] the Primary Key of the table, or create a unique
Index on the field. A validation rule isn't the right place to do
this.

I wish I could, but i am copying these numbers off of the cards that
were all ready issued, but these numbers are not in order. Please help
thankx
 
G

GVaught

It doesn't matter whether they are in order. If you have the value set as
unique or as a primary key, you can't add the number period! If the number
exists in that field it will tell you, otherwise it will be entered as a
valid number. Setting the field as Primary will alphabetize the values
automatically. If you want the values in alpha order on your form, then
create a query which will sort by that field and use that query to connect
your form. Be sure to add all the fields from the table to the query so it
will be updateable.


Skully Matjas said:
I want to set a validation rule that a field cant have the same number
as another entery for the same field.
I want it to do this when i am entering it into a form, so if it is a
duplicate it would tell me that.

The form and table name iS: "Ralphs cards" the field is called
"Ralphs#"

Simply make [Ralphs#] the Primary Key of the table, or create a unique
Index on the field. A validation rule isn't the right place to do
this.

I wish I could, but i am copying these numbers off of the cards that
were all ready issued, but these numbers are not in order. Please help
thankx
 
J

John Vinson

I wish I could, but i am copying these numbers off of the cards that
were all ready issued, but these numbers are not in order. Please help
thankx

That makes no difference whatsoever!

All a Primary Key does is ensure that the field value is unique within
that table. It makes no assumptions about the order of records. In
fact, the table will be *displayed* in primary key order, by default,
in a table datasheet - but the order in which the records is stored is
arbitrary and uncontrollable. It needn't be in primary key order nor
in the order entered; if you want to see the records in a particular
order, you need to use a Query with a sort term.
 
G

Guest

Thank you. Also, can i import a data into a table and
then assign a prmary key to new data that i will enter
into that table

-----Original Message-----
It doesn't matter whether they are in order. If you have the value set as
unique or as a primary key, you can't add the number period! If the number
exists in that field it will tell you, otherwise it will be entered as a
valid number. Setting the field as Primary will alphabetize the values
automatically. If you want the values in alpha order on your form, then
create a query which will sort by that field and use that query to connect
your form. Be sure to add all the fields from the table to the query so it
will be updateable.


On Wed, 22 Oct 2003 00:58:07 GMT, Skully Matjas

I want to set a validation rule that a field cant
have the same
number
as another entery for the same field.
I want it to do this when i am entering it into a
form, so if it is
a
duplicate it would tell me that.

The form and table name iS: "Ralphs cards" the field is called
"Ralphs#"

Simply make [Ralphs#] the Primary Key of the table,
or create a
unique
Index on the field. A validation rule isn't the right place to do
this.

John W. Vinson[MVP]
Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps? loc=us&access=public

I wish I could, but i am copying these numbers off of the cards that
were all ready issued, but these numbers are not in order. Please help
thankx


.
 
J

John Vinson

Thank you. Also, can i import a data into a table and
then assign a prmary key to new data that i will enter
into that table

A Primary Key applies to the entire table, and it makes no difference
how the data gets into the table: it will simply prevent duplicates in
the Primary Key field (or fields), whether those records are imported
or typed in.
 

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

Top