Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    May 2005
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Dlookup() criteria (2003)

    I am trying to use Dlookup in a text box> The data is from a table and the criteria is from a text box(unbound) in a form. Though I have other dlookup textboxes that work fine they are all based on queries.

    If I set the criteria to a fixed value it returns the correct value. However when I use the form reference as a criteria I get error message 2001 "you cancelled the previous operation" or error 3075 missing operator in query expression '[procedure] ='.

    DLookUp("[procedurecode]","[dxcode]","[procedure] = " & [Forms]![insurance]![service]) I've tried this in the immediate window. The criteria expression, by itself, works fine.
    Procedurecode is a numeric field and procedure a text field.

    I've tried this with a single table in a new db with the same results. I've changed the field names...same results

    Something obvious?

    nebbia

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Dlookup() criteria (2003)

    Try
    <code>
    =DLookUp("[procedurecode]","[dxcode]","[procedure] = " & Chr(34) & [Forms]![insurance]![service] & Chr(34))
    </code>
    Chr(34) is the double quote character <code>"</code>, it is necessary to enclose a text value in quotes.

  3. #3
    2 Star Lounger
    Join Date
    May 2005
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Dlookup() criteria (2003)

    Thanks that was the missing piece

    nebbia

Posting Permissions

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