Results 1 to 3 of 3
  1. #1
    d9pierce1 is offline Expert
    Windows 10 Access 2016
    Join Date
    Jan 2012
    Location
    Oklahoma
    Posts
    754

    DLookup Nested ?


    Hi all,
    I am trying to use a DLookup to put a value in a txt box from a query on a different form.
    The following works fine how ever I am trying to nest it with a "WHERE" the ChkBox Preferred = True which is on the same query

    TxtCompanyType = DLookup("CompanyTypeName", "Query1", "CompanyId= " & CompanyID)

    I want to add to this to the DLookup above Where my check box "Preferred" = True

    I have tried to add this 9 ways to sunday and I keep getting end of statement errors????
    Thanks
    Dave

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    Is Preferred a yes/no field in Query1? You want to pull record where Preferred is True?

    TxtCompanyType = DLookup("CompanyTypeName", "Query1", "CompanyId= " & CompanyID & " AND Preferred=True")
    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
    d9pierce1 is offline Expert
    Windows 10 Access 2016
    Join Date
    Jan 2012
    Location
    Oklahoma
    Posts
    754
    Yes to your questions, and thank you so much!
    Worked like a charm

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

Similar Threads

  1. IIF With Nested IIF?
    By jo15765 in forum Queries
    Replies: 5
    Last Post: 08-08-2016, 06:41 AM
  2. Replies: 2
    Last Post: 02-05-2015, 11:02 PM
  3. Nested IF
    By balajigade in forum Queries
    Replies: 3
    Last Post: 10-04-2014, 10:23 AM
  4. nested iif
    By slimjen in forum Reports
    Replies: 1
    Last Post: 03-15-2014, 09:30 AM
  5. Nested DLookup
    By jamarogers in forum Programming
    Replies: 8
    Last Post: 10-13-2013, 12:20 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