Sabtu, 28 Juni 2014

[MS_AccessPros] Check duplicate record

 

Hi All,
I am honored to say that i have learnt a lot from this group with the utmost support and guidance of all seniors and MVP's. That is why i am able to make new databases.

Now i am stuck in an event and need help, error message says:
Run-time error '3075'
Syntax error (missing operator) in query expression....

Private Sub cboMemberID_BeforeUpdate(Cancel As Integer)
    Dim SID As String
    Dim stLinkCriteria As String
    Dim rsc As DAO.Recordset
   
    stLinkCriteria = "[MembershipType]='" & [cboMembershipType] & "' and [MemberID]=" & cboMemberID & _
    " and [CstName]=" & [cboCstName] & ""
           

   'Check CST Transaction table for duplicate MemberID for selected CstName
    If DCount("*", "CST Transaction", stLinkCriteria) > 0 Then
        'Message box warning of duplication
        MsgBox "This Member ID: " & [MemberID] & " has already been allotted" & vbCrLf & _
        "For Membership type: " & [cboMembershipType] & vbCrLf & _
        "And CST Name: " & [cboCstName] & vbCrLf & _
        "" & vbCrLf & _
        "You will now been taken to the record of Member ID '" & [MemberID] & "'" _
        , vbInformation, "SCP Guide - Duplicate Entry"

        'Undo duplicate entry
        Me.Undo
        CmdUndoAddRcrdEmp.Enabled = False
                
        'Go to record of original MemberID for selected CstName
        Set rsc = Me.RecordsetClone
        rsc.FindFirst stLinkCriteria
        Me.Bookmark = rsc.Bookmark
    End If
    Set rsc = Nothing
End Sub

Regards,
Khalid


__._,_.___

Posted by: Khalid Tanweer <khalidtanweerburrah@yahoo.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)

.

__,_._,___

Tidak ada komentar:

Posting Komentar