If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Validation Rule
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. -- Thanks, Tom |
#2
|
|||
|
|||
Validation Rule
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 "Tom" wrote in message ... 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. -- Thanks, Tom |
#3
|
|||
|
|||
Validation Rule
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 "Tom" wrote in message ... 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. -- Thanks, Tom |
#4
|
|||
|
|||
Validation Rule
Rick:
Thanks!!! That works perfect! Tom "Rick B" wrote in message ... 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 "Tom" wrote in message ... 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. -- Thanks, Tom |
Thread Tools | |
Display Modes | |
|
|