Results 1 to 2 of 2

Thread: Dlookup (2003)

  1. #1
    2 Star Lounger
    Join Date
    Jun 2004
    Thanked 0 Times in 0 Posts

    Dlookup (2003)

    I am trying to do a look up in a table, and the value is coming back null, but it shouldn't. The value I am trying to lookup is a date.
    Here is my code:
    dim LooKup
    LookUp = DLookup("[Week#]", "tblSubmit", "[Week#] = " & _

    the value in me.txtCurWkSt is a date, ex: 2/2/2006. There is a value in the tblSumbit in the Week# field so the value shouldnt return null should it?
    thanks for your help

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 31 Times in 31 Posts

    Re: Dlookup (2003)

    Literal date values must be enclosed in # characters. If there is any chance that the end user will be using a non-US date format, you must ensure that the date is converted to US format:

    LookUp = DLookup("[Week#]", "tblSubmit", "[Week#] = #" & _
    Format(Me.txtCurWkSt, "mm/dd/yyyy") & "#")

    But wouldn't the result be identical to Week#?

Posting Permissions

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