Validation message for indexed field on form (1 Viewer)

tezread

Registered User.
Local time
Today, 21:14
Joined
Jan 26, 2010
Messages
330
Hi thereThank goodness its Friday eh?I have a form witha field in it that indexed called UnitNumber, allowing no duplicates. I was wondering how to add a validation message telling the user that the 'unit number already exists' etc if they try and enter the same numberNot the best with VBA so be gentle
 

tezread

Registered User.
Local time
Today, 21:14
Joined
Jan 26, 2010
Messages
330
Fixed it!If Me.NameOfControl.Value = DLookup("[NameOfCorrespondingTableField]","NameOfTable","[NameOfCorrespondingTableField] = '" & Me.NameOfControl.Value & "'") ThenCancel = TrueMsgBox "YourMessage"End If
 

Users who are viewing this thread

Top Bottom