anujkmehrotra
Programmer
- Jan 21, 2012
- 17
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
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