John,
Private Sub CartonNo_BeforeUpdate(Cancel As Integer)
Dim stLinkCriteria As String
Dim rsc As DAO.Recordset
' Don't check if not on a new row
If Not Me.NewRecord Then Exit Sub
stLinkCriteria = "[CartonSuffix]='" & [CartonSuffix] & "' and [CartonNo] =" & [CartonNo] & _
" and [ClientCIN]=" & [cmbClientCIN] & " and [ConsignmentNo]='" & [ConsignmentNo] & "'"
Debug.Print stLinkCriteria
'Check CollectionVoucher table for duplicate CartonNo
If DCount("*", "CollectionVoucher", stLinkCriteria) > 0 Then
'Message box warning of duplication
MsgBox " Carton Number: " & [CartonNo] & "-" & [CartonSuffix] & " has already been punched vide Contract No. " & [cmbDeliveryVr] & "." & vbCrLf & _
"for Consignor: " & [cmbClientCIN] & "-" & ClientSelected & ", Consingee: " & ClientConsignee & "." & vbCrLf & _
"In Consignment No. " & [ConsignmentNo] & "." _
, vbInformation, "Duplicate Entry"
'Undo duplicate entry
Me.Undo
'Go to record of original CartonNo
' Set rsc = Me.RecordsetClone
' rsc.FindFirst stLinkCriteria
' Me.Bookmark = rsc.Bookmark
' Set rsc = Nothing
End If
End Sub
---In MS_Access_Professionals@yahoogroups.com, <JohnV@...> wrote :
John,
---In MS_Access_Professionals@yahoogroups.com, <JohnV@...> wrote :
John,
---In MS_Access_Professionals@yahoogroups.com, <JohnV@...> wrote :
John,
---In MS_Access_Professionals@yahoogroups.com, <khalidtanweerburrah@...> wrote :
---In MS_Access_Professionals@yahoogroups.com, <JohnV@...> wrote :
---In MS_Access_Professionals@yahoogroups.com, <khalidtanweerburrah@...> wrote :
Posted by: khalidtanweerburrah@yahoo.com
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (10) |
Tidak ada komentar:
Posting Komentar