Senin, 20 Januari 2020

Re: [MSAccessProfessionals] Duplication of entry is not checked

Hi all,
Sorry for botheration, the code is now as:

Private Sub TripNo_BeforeUpdate(Cancel As Integer)
 Dim SID As Long
    Dim stLinkCriteria As String
    Dim rsc As DAO.Recordset
 
    Set rsc = Me.RecordsetClone
 
    SID = Me.TripNo.Value
       
    stLinkCriteria = "[TripNo]=" & SID
 
    'Check Add New Cst table for duplicate TripNo
    If DCount(TripNo, "CST", _
              stLinkCriteria) > 0 Then
        'Undo duplicate entry
        Me.Undo
        'Message box warning of duplication
        MsgBox "TripNo: '" & SID & "' has already been allotted." & vbCrLf & _
              "You will now been taken to the record of TripNo. '" _
              & SID & "'.", vbExclamation _
        , "PTF Guide - Duplicate Entry"
        'Go to record of original TripNo
        rsc.FindFirst stLinkCriteria
        Me.Bookmark = rsc.Bookmark
    End If
    Set rsc = Nothing
End Sub

Thanks for replies,
Khalid
_._,_._,_

Groups.io Links:

You receive all messages sent to this group.

View/Reply Online (#115410) | Reply To Group | Reply To Sender | Mute This Topic | New Topic

Your Subscription | Contact Group Owner | Unsubscribe [sugeng.panjalu.access@blogger.com]

_._,_._,_

Tidak ada komentar:

Posting Komentar