Results 1 to 6 of 6
  1. #1
    Garry is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Sep 2014
    Location
    Missouri
    Posts
    3

    DLookup in Queries

    I'm trying to use Dlookup in a query and just can't seem to get it setup right. The Query is based on table: Coin Collection Table.

    I'm trying to pull Exchange Rate from a table 'Coin Country Table' into my query. This is what I've got

    Exchange Rate: DLookUp("[Exchange Rate]","[Coin Countries Table]","Country=" & [COUNTRY])

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    What is wrong, what happens - error message, wrong results, nothing?

    Is Country a text field? If so, need text delimiters.

    Exchange Rate: DLookUp("[Exchange Rate]","[Coin Countries Table]","Country='" & [COUNTRY] & "'")

    Can't you just do a query that joins the tables on country fields?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Garry is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Sep 2014
    Location
    Missouri
    Posts
    3
    I get an error message: #Error
    country is a text field in the query and the Coin County Table
    I can do such a query, but the result isn't updateable, and I need to be able to update it.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Why isn't join query updatable? Post the query. Which table do you want to edit?

    The DLookup syntax is correct but apparently Access can't find field or table. Make sure everything is spelled correctly.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    GinaWhipp's Avatar
    GinaWhipp is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jul 2011
    Location
    Ohio, USA
    Posts
    377
    Quote Originally Posted by Garry View Post
    I'm trying to use Dlookup in a query and just can't seem to get it setup right. The Query is based on table: Coin Collection Table.

    I'm trying to pull Exchange Rate from a table 'Coin Country Table' into my query. This is what I've got

    Exchange Rate: DLookUp("[Exchange Rate]","[Coin Countries Table]","Country=" & [COUNTRY])
    Hmm, is the table named *Coin Country Table* or Coin Countries Table*? Another thought, seems to me those two table should be related (if they are aren't seems like they should be) via *CoinID*, so why not just drop the table in the query window and then put your field in?

  6. #6
    Garry is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Sep 2014
    Location
    Missouri
    Posts
    3
    Couple of you were on the right track about relating tables/queries. I just thought it was normal a query with related tables wouldn't be updateable.
    So I read up on queries and checked out my relationships - and found an error.
    Now I've got everything working.

    Thanks all.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 9
    Last Post: 08-27-2014, 11:34 AM
  2. DLookUp
    By Subwind in forum Programming
    Replies: 4
    Last Post: 11-29-2013, 12:39 AM
  3. Replies: 6
    Last Post: 11-13-2013, 04:17 PM
  4. DLookup example
    By pkstormy in forum Code Repository
    Replies: 1
    Last Post: 07-16-2012, 09:52 AM
  5. Dlookup Help
    By SMC in forum Programming
    Replies: 2
    Last Post: 06-26-2012, 07:49 AM

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
  •  
Other Forums: Microsoft Office Forums