user1795322
user1795322

Reputation: 31

Avoiding that two fields have the same values

I am using Access 2010.

I have a Table named Person : Id(key), field1(int), field2(int).

I want to avoid that field1 will be equal to field2.

Is this possible?

Upvotes: 3

Views: 297

Answers (1)

HansUp
HansUp

Reputation: 97131

With your table in Design View, open its Property Sheet and set the table Validation Rule to [field1]<>[field2] like this ...

enter image description here

Note that if you omit the square brackets surrounding the field names, Access may convert them to text values ... "field1"<>"field2". You don't want that.

BTW, I typically change the Subdatasheet Name property to [None], but that's not an issue related to the Validation Rule.

Upvotes: 5

Related Questions