Results 1 to 3 of 3
  1. #1
    Join Date
    May 2014
    Posts
    16

    Unanswered: dlookup using dates

    I am new to Access and VBA programming and not very developed or advanced.

    I am having problems with MS Access VBA doing a
    Dlookup on a date field.

    The field in the table looks like this:

    VacationDate DateTime

    The Dlookup looks like this:

    result = Nz(DLookup("[vacationdate]", "[vacation]", "vacationdate='" & Me.vacationDate.Value & "'"))

    I get an error message Run-time error '3434" Mismatch ic criteria expression.


    Anyone know what is wrong here?

  2. #2
    Join Date
    May 2014
    Posts
    16

    dlookup using a date

    I am new to Access and VBA programming and not very developed or advanced.

    I am having problems with MS Access VBA doing a
    Dlookup on a date field.

    The field in the table looks like this:

    VacationDate DateTime

    The Dlookup looks like this:

    result = Nz(DLookup("[vacationdate]", "[vacation]", "vacationdate='" & Me.vacationDate.Value & "'"))

    I get an error message Run-time error '3434" Mismatch ic criteria expression.


    Anyone know what is wrong here?

  3. #3
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Try using:
    Code:
    result = Nz(DLookup("vacationdate", "vacation", "vacationdate=#" & Format(Me.vacationDate.Value, "yyyy-mm-dd") & "#"))
    This should prevent any kind of mismatch in a date value.
    Have a nice day!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •