Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

contact management DB

Status
Not open for further replies.

kkrev

Technical User
Oct 10, 2000
13
0
0
US
In the contact table, I want to be able to put in a unique number identifying a client and have the record come up automatically if it is already inputted. Right now I save it to see if it will be rejected to know if it is already has been inputted. What's an easier way?
 
In the BeforeUpdate event procedure for the control test to see if the value already exists. If so, then display a message and undo the change.

...
Dim vReply As Variant
If Me.ActiveControl = DLookUp("[FieldName]", "TableName", "[FieldName] = " & Me.ActiveControl Then
vReply = MsgBox ("Value Already Exists", vbOKOnly)
DoCmd.CancelEvent
Me.Undo
End If
...
 
Thanks for commenting, I am a nurse trying to keep track of my patients so this is new for me. where does this command line go in the design? On the table or on the form? and in which property in the design?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top