Validation message for indexed field on form

tezread

Registered User.
Local time
Today, 02:17
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
 
Fixed it!If Me.NameOfControl.Value = DLookup("[NameOfCorrespondingTableField]","NameOfTable","[NameOfCorrespondingTableField] = '" & Me.NameOfControl.Value & "'") ThenCancel = TrueMsgBox "YourMessage"End If
 

Users who are viewing this thread

Back
Top Bottom