Results 1 to 4 of 4
  1. #1
    S1naps1s is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2014
    Posts
    8

    DLookup type Mismatch

    I don't know what I am doing wrong. Someone please help! I am doing a DLookup and I am getting error code 13 type mismatch.
    This is my code.

    EntDay = DLookup("EntitleType", "tblEntitlements", "ClockNbrID = " & Me.ClockNbrID & "" And "[EntitleStartDate] <= #" & DayID & "#" And "[EntitleEndDate] >= #" & DayID & "#")

    These are the codes


    Dim Ent Day As String
    Dim DayID As Date
    EntitleType is set as Text in the table tblEntitlements
    EntitleStartDate is a Date/Time in the table tblEntitlements
    EntitleEndDate is a Date/Time in the table tblEntitlements

    I am sure it is something simple, but I can't figure out what I am doing wrong.

  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
    You have extraneous quotes. Try

    EntDay = DLookup("EntitleType", "tblEntitlements", "ClockNbrID = " & Me.ClockNbrID & " And [EntitleStartDate] <= #" & DayID & "# And [EntitleEndDate] >= #" & DayID & "#")
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    S1naps1s is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2014
    Posts
    8
    Awesome! Thanks!

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. DLookup Type Mismatch Error
    By DCV0204 in forum Forms
    Replies: 2
    Last Post: 02-11-2014, 01:54 PM
  2. type mismatch
    By seeker63 in forum Programming
    Replies: 2
    Last Post: 12-05-2013, 02:54 PM
  3. VBA DLookup - Type Mismatch
    By hannuk in forum Access
    Replies: 2
    Last Post: 01-03-2012, 06:33 AM
  4. Newbie. DLookup gives type mismatch error.
    By graffiti in forum Programming
    Replies: 4
    Last Post: 12-13-2011, 05:22 AM
  5. DLookup not recognizing valid record/type mismatch
    By walter189 in forum Programming
    Replies: 3
    Last Post: 07-21-2011, 07:03 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