Results 1 to 7 of 7
  1. #1
    4 Star Lounger
    Join Date
    Feb 2001
    Location
    BECCLES, Suffolk, England
    Posts
    407
    Thanks
    0
    Thanked 0 Times in 0 Posts

    DLookup puzzle (WXpHe & MsO2003)

    Edited by HansV because name beginning with tr between square brackets disappeared

    This is on a form, and correctly displays a Client's name according to the matching of their Code in the form against that of the Query
    =DLookUp("[QryAllClientNames]![Client Name]","QryAllClientNames","[QryAllClientNames]![Code]=<!t>[trINDCode]") This Works! <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

    Now, doing the same thing in a new query:
    Expr1: DLookUp([QryAllClientNames]![Client Name],"QryAllClientNames","[QryAllClientNames]![Code]=<!t>[trIndCode]") where <!t>[trIndCode] does exist in the Query results in being asked for Enter Parameter Value QryAllClientNames!Client Name

    I'd be pleased to receive help with this - Is it possible to have dlookup in a query?

    The reason of using dlookup is because in this query there are 1125 records (the correct number), when I bring in the QryAllClientNames then the records displayed are reduced to 1115 !
    <IMG SRC=http://www.wopr.com/w3tuserpics/StephenElms_sig.jpg> Didn't think that I made my first post here on 5th February 2001...!

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

    Re: DLookup puzzle (WXpHe & MsO2003)

    Yes, you can use DLookup in a query. Try
    <code>
    Expr1: DLookUp([Client Name],"QryAllClientNames","[Code]=<!t>[trIndCode]")
    </code>
    or
    <code>
    Expr1: DLookUp([Client Name],"QryAllClientNames","[Code]=" & <!t>[trIndCode])
    </code>
    if Code is a number field, or
    <code>
    Expr1: DLookUp([Client Name],"QryAllClientNames","[Code]=" & Chr(34) & <!t>[trIndCode] & Chr(34))
    </code>
    if Code is a text field

  3. #3
    4 Star Lounger
    Join Date
    Feb 2001
    Location
    BECCLES, Suffolk, England
    Posts
    407
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: DLookup puzzle (WXpHe & MsO2003)

    Hi Hans, thanks for those expressions:
    the 1st asked for Client Name and then ren message that it was typed incorrectly
    2nd asked for Client Name, opened the query in data view showing #Error in the column
    3rd asked for Client Name, opened the query in data view showing #Error in the column
    4th asked for Client Name, opened the query in data view showing #Error in the column - this one I hoped would work as my data <trIndCode> is four text characters.

    Any further ideas please?
    <IMG SRC=http://www.wopr.com/w3tuserpics/StephenElms_sig.jpg> Didn't think that I made my first post here on 5th February 2001...!

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

    Re: DLookup puzzle (WXpHe & MsO2003)

    I posted only 3 options, I wonder how you got 4.

    Could you post a stripped down copy of your database? See <post#=401925>post 401925</post#> for instructions.

  5. #5
    4 Star Lounger
    Join Date
    Feb 2001
    Location
    BECCLES, Suffolk, England
    Posts
    407
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: DLookup puzzle (WXpHe & MsO2003)

    Whoops - sorry Hans, you are correct, I was wrong - there are just three options. Therefore please take my comment on 4 to be regarding item 3.
    Apologies.
    <IMG SRC=http://www.wopr.com/w3tuserpics/StephenElms_sig.jpg> Didn't think that I made my first post here on 5th February 2001...!

  6. #6
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: DLookup puzzle (WXpHe & MsO2003)

    The name of the searched field should be surround by double quotes. Try :
    <pre>Expr1: DLookUp("[Client Name]","QryAllClientNames","[Code]=" & Chr(34) & <trIndCode> & Chr(34))</pre>

    Francois

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

    Re: DLookup puzzle (WXpHe & MsO2003)

    Oops, should have noticed that! Thanks!

Posting Permissions

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