Results 1 to 4 of 4
  1. #1
    nick243 is offline Competent Performer
    Windows 7 64bit Access 2002
    Join Date
    May 2016
    Posts
    185

    Dlookup Issue



    Code:
    Private Sub Command39_Click()
    Dim MEFVar, MEFVarX, ChargebackNumVarX, ApproveDateVar, StatusVar, VendorNameVar, VendorNumberVar, MainfestVar
    
    ' Check that the MEF is 6 digits
    MEFVar = InputBox("Enter a MEF Number to start a new Chargeback:", "Open New Chargeback")
    If Len(MEFVar) <> 6 Then
        MsgBox MEFVar & " is not a valid MEF Number."
        End
    End If
    
    
    'Capture MEF information
    VendorNameVar = InputBox("Enter Vendor Name to start a new Chargeback:", "Open New Chargeback")
    If IsNull(VendorNameVar) = True Then
        VendorNameVar = "ENTER VENDOR"
    End If
    
    
    
    ManifestVar = DLookup("Manifest", "MEFSummaryChargeback", "MEF = '" & MEFVar & "'" And "Vendor = '" & VendorNameVar & "'")
    It gives me a Run-tiem error 13 type mismatch in the bold code above. I included how i got the criteria above and the declared variables.

    It looks as though my criteria is being filled with the correct numbers but ManifestVar is not getting a result.

    Thanks,
    Nick

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    A common mistake; drop the double quotes on both sides of And.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Too many quotes. Get rid on the RED ones.
    ManifestVar = DLookup("Manifest", "MEFSummaryChargeback", "MEF = '" & MEFVar & "'" And "Vendor = '" & VendorNameVar & "'")

    It should read:

    ManifestVar = DLookup("Manifest", "MEFSummaryChargeback", "MEF = '" & MEFVar & "' And Vendor = '" & VendorNameVar & "'")

  4. #4
    nick243 is offline Competent Performer
    Windows 7 64bit Access 2002
    Join Date
    May 2016
    Posts
    185
    Thank you for the quick responses. The changes worked great.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. dlookup issue
    By Gina Maylone in forum Access
    Replies: 2
    Last Post: 05-09-2017, 11:36 AM
  2. DLookup Issue
    By sdel_nevo in forum Programming
    Replies: 10
    Last Post: 05-18-2013, 08:51 AM
  3. DLookup issue
    By Alex Motilal in forum Programming
    Replies: 7
    Last Post: 04-17-2013, 12:41 PM
  4. Dlookup issue
    By brharrii in forum Programming
    Replies: 3
    Last Post: 06-22-2012, 07:08 PM
  5. DLookup issue
    By seth1685 in forum Programming
    Replies: 5
    Last Post: 01-12-2012, 08:55 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums