Results 1 to 10 of 10
  1. #1
    Bertrand82 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Sep 2012
    Posts
    48

    Dlookup in query

    Hi,



    I would like to create a Dlookup function in [qryAnimals]

    The purpose of the function is to retrieve te correct "animal" from [tblAnimals] matched by ID.

    Please use my attached file.

    Br Betrand
    Attached Files Attached Files

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    Something wrong with this db. It is not recognizing the intrinsic DLookup function. This should work but isn't:

    SELECT tblAnimals.ID, DLookUp("Animal","tblAnimals","ID=" & [ID]) AS DLookupFunction FROM tblAnimals;
    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
    DatabaseMakers is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2012
    Location
    London
    Posts
    12
    It's because the project is named DLookUp!~)

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    I renamed the database. Query still doesn't work.
    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
    DatabaseMakers is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2012
    Location
    London
    Posts
    12
    You need to rename the Project in the vba editor properties.

  6. #6
    DatabaseMakers is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2012
    Location
    London
    Posts
    12
    You can keep the name of the database.

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    Okay, that did it. Never ran into this before.
    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.

  8. #8
    DatabaseMakers is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2012
    Location
    London
    Posts
    12
    Try and name a public function the same as the project name and run it... It will not work!~)

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    I knew about naming conflicts, but never encountered and just didn't come to mind.
    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.

  10. #10
    Bertrand82 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Sep 2012
    Posts
    48
    Thank you guys, excellent support!

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

Similar Threads

  1. DLOOKUP two tables in query
    By sockswithsandals in forum Queries
    Replies: 3
    Last Post: 04-17-2012, 06:55 AM
  2. DLookup in Query
    By mfrey40 in forum Queries
    Replies: 3
    Last Post: 12-27-2011, 12:41 AM
  3. DLookUp Query across multiple tables
    By karldou in forum Queries
    Replies: 2
    Last Post: 12-19-2011, 02:26 PM
  4. Query with Dlookup
    By mari_hitz in forum Queries
    Replies: 5
    Last Post: 10-14-2011, 09:22 PM
  5. Query Dlookup different fields
    By newwales in forum Access
    Replies: 1
    Last Post: 07-07-2011, 10:13 AM

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