Validation Rule

  • Thread starter Thread starter Tom
  • Start date Start date
T

Tom

I am wondering if someone knows how to create a validation rule in a table that would throw an error message in a form.

Here's what I have in a table:

Field1
- Data type = Number
- Indexed = "Yes (Duplicates OK)"

Field2
- Data type = Text
- Indexed = "No"


Validation Rule Requirements:
- The value of Field2 must be unique within the range of same value range of Field1


Examples of Allowed Records:

Field1 Field2
====== ======
1 A
1 B
1 C
2 A
2 B
3 B


Examples of Not Allowed Records:

Field1 Field2
====== ======
1 A
1 B
1 B
2 A
2 B
3 B


Here, the values of the 2nd record and 3rd record (Field1 = 1, Field2 = B) are identical. Therefore, when entering the 3rd record, I want to throw an error message in a form that indicates
that Field2 value of "B" already exists.

Is that possible?


P.S. I don't want to use autonumbers for this table.
 
You need to create a key for your table based on two fields. I believe you hold down the CTRL key while you click the fields, then click the "key" button at the top of your screen.

Rick B


I am wondering if someone knows how to create a validation rule in a table that would throw an error message in a form.

Here's what I have in a table:

Field1
- Data type = Number
- Indexed = "Yes (Duplicates OK)"

Field2
- Data type = Text
- Indexed = "No"


Validation Rule Requirements:
- The value of Field2 must be unique within the range of same value range of Field1


Examples of Allowed Records:

Field1 Field2
====== ======
1 A
1 B
1 C
2 A
2 B
3 B


Examples of Not Allowed Records:

Field1 Field2
====== ======
1 A
1 B
1 B
2 A
2 B
3 B


Here, the values of the 2nd record and 3rd record (Field1 = 1, Field2 = B) are identical. Therefore, when entering the 3rd record, I want to throw an error message in a form that indicates
that Field2 value of "B" already exists.

Is that possible?


P.S. I don't want to use autonumbers for this table.
 
After you do that, you can select "Indexes" from the "View" menu to see more options for your key.

See "help" for more details.

HTH

Rick B

I am wondering if someone knows how to create a validation rule in a table that would throw an error message in a form.

Here's what I have in a table:

Field1
- Data type = Number
- Indexed = "Yes (Duplicates OK)"

Field2
- Data type = Text
- Indexed = "No"


Validation Rule Requirements:
- The value of Field2 must be unique within the range of same value range of Field1


Examples of Allowed Records:

Field1 Field2
====== ======
1 A
1 B
1 C
2 A
2 B
3 B


Examples of Not Allowed Records:

Field1 Field2
====== ======
1 A
1 B
1 B
2 A
2 B
3 B


Here, the values of the 2nd record and 3rd record (Field1 = 1, Field2 = B) are identical. Therefore, when entering the 3rd record, I want to throw an error message in a form that indicates
that Field2 value of "B" already exists.

Is that possible?


P.S. I don't want to use autonumbers for this table.
 
Rick:

Thanks!!! That works perfect!


Tom



You need to create a key for your table based on two fields. I believe you hold down the CTRL key while you click the fields, then click the "key" button at the top of your screen.

Rick B


I am wondering if someone knows how to create a validation rule in a table that would throw an error message in a form.

Here's what I have in a table:

Field1
- Data type = Number
- Indexed = "Yes (Duplicates OK)"

Field2
- Data type = Text
- Indexed = "No"


Validation Rule Requirements:
- The value of Field2 must be unique within the range of same value range of Field1


Examples of Allowed Records:

Field1 Field2
====== ======
1 A
1 B
1 C
2 A
2 B
3 B


Examples of Not Allowed Records:

Field1 Field2
====== ======
1 A
1 B
1 B
2 A
2 B
3 B


Here, the values of the 2nd record and 3rd record (Field1 = 1, Field2 = B) are identical. Therefore, when entering the 3rd record, I want to throw an error message in a form that indicates
that Field2 value of "B" already exists.

Is that possible?


P.S. I don't want to use autonumbers for this table.
 
Back
Top