John,
One factor for duplicate CartonNo values within the displayed Consignments is that often there are more than one Client sending there consignments, so obviously there will be duplicate CartonNo values, suppose for ConsignmentNo. 2014-A-05 ClientCIN 1 delivered CartonNo 1 to 20 and ClientCIN 2 delivered CartonNo 1 to 30 then CartonNo 1 to 20 would be duplicates.
The other factor which i figured out is critical for that i am been forced by my boss, due to some reasons i am asked to shift all or certain Cartons to another Consignment.
For example: In ConsignmentNo. 2014-B-02, ClientCIN 1 delivered 50 cartons 1 - 50 and then boss says shift them to ConsignmentNo. 2014-A-05, then there will be duplicate CartonNo, , because Cartons shifted also do contain 1 - 20 same as in 2014-A-05 before, this i do manually by opening the table CollectionVoucher and changing these CartonNo 1-50 of ConsignmentNo 2014-B-02 to 2014-A-05.
The reason for editing this manually is that on the form "Collection Voucher" on control CartonNo i have a before Update event for checking of duplicate CartonNo for the same ConsignmentNo., which is:
Private Sub CartonNo_BeforeUpdate(Cancel As Integer)
Dim stLinkCriteria As String
Dim rsc As DAO.Recordset
stLinkCriteria = "[DeliveryVr]='" & [cmbDeliveryVr] & "' and [CartonNo]=" & [CartonNo] & _
" and [ClientCIN]=" & [cmbClientCIN] & " and [ConsignmentNo]='" & [ConsignmentNo] & "'"
'Check CollectionVoucher table for duplicate CartonNo
If DCount("*", "CollectionVoucher", stLinkCriteria) > 0 Then
'Message box warning of duplication
MsgBox "This Carton Number: " & [CartonNo] & " has already been allotted" & vbCrLf & _
"in Consignment No.'" & [ConsignmentNo] & "'," & vbCrLf & _
"vide Contract No.'" & [cmbDeliveryVr] & "' for Client CIN: " & [cmbClientCIN] & "." _
, vbInformation, "PCTL - 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
Hope you got my problems, at this stage i cannot change Cartons numbers which are duplicate. As many reports / documents have already been prepared signed and submitted.
Khalid
__._,_.___
Posted by: khalidtanweerburrah@yahoo.com
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (15) |
.
__,_._,___
Tidak ada komentar:
Posting Komentar