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!

Stop Duplicate Values for Different Ids

Status
Not open for further replies.

anujkmehrotra

Programmer
Jan 21, 2012
17
0
0
Here is an example to stop user to enter or choose Duplicate Service value as per Different ChasisNo (Not UniqueID).

Code:

Private Sub Service_AfterUpdate()
Dim stLinkCriteria As String
stLinkCriteria = "Service = """ & Me.Service & """ And ChasisNo = """ & Me.ChasisNo & """"

If DCount("*", "tblSerJobCard", stLinkCriteria) > 0 Then
MsgBox ("You have already done this service to the customer."), vbExclamation, "Error"
Cancel = True
Me.Service = ""
Me.Service.SetFocus
End If
End Sub
--------
Hope this will help someone to make something possible.


Thanks & Regards,
Anuj
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top