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

    Dlookup in a Query (Access 2003)

    Edited by HansV to avoid problem with text between brackets

    Hi can you do a DLookup in a query?

    Name: DLookUp([QryAllClientNames]![Client Name],[QryAllClientNames],[QryAllClientNames]![Code]=<!t>[trIndCode])

    Thanks
    <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 in a Query (Access 2003)

    The arguments to DLookup are strings. Try this:
    <code>
    Name: DLookUp("[Client Name]","QryAllClientNames","Code=" & <!t>[trIndCode])
    </code>
    if trIndCode is numeric, or
    <code>
    Name: DLookUp("[Client Name]","QryAllClientNames","Code=" & Chr(34) & <!t>[trIndCode] & Chr(34))
    </code>
    if it is text.

  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 in a Query (Access 2003)

    Thanks Hans, we got it working from this.
    <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
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Dlookup in a Query (Access 2003)

    If performance becomes an issue, you might want to reconsider using dlookup in the query. Try just doing a Join to that table, or use a subquery.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

Posting Permissions

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