Results 1 to 4 of 4
  1. #1
    Raddle is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Sep 2021
    Posts
    60

    Dlookup on a bound form

    Hi



    I have a form with fields displaying data from the main table.
    I would like to add a new field with a Dlookup, to look in another table for contact info.

    =DLookUp("[Contact_1]","Tbl_Teams,"[MaintTeam] = '& me.Team_Name &'")

    Is this possible?

    I guess one answer would be to run a query for the form and base the whole thing on that, but I don't really want to do that for other reasons - the contact information is actually in two different tables. I jknow ..

    Even as I type I sense this is not possible with this schema.

    Any hints ?

  2. #2
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,815
    Why don't you just try it and find out for yourself in less than five minutes? I don't see why it would not work as long as your syntax is correct (which it is not). Maybe

    =DLookUp("[Contact_1]","Tbl_Teams","[MaintTeam] = '" & me.Team_Name & "'")
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    Raddle is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Sep 2021
    Posts
    60
    Hi - thanks for coming back to me.

    Yep fair comment and I did try a query, and it worked perfectly.

    However using your code I get a Name? error, which I think might be due to the fact that I have the fields set out on tab pages, which might be tanking the me. part of the snippet.

    But I will keep plugging away.

    Thanks again

  4. #4
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,815
    Then stick with what works I guess. We can only base answers on the details anyone presents. If referenced controls lie on things like subforms, nav forms or tab pages and no one says so, success is not likely. This occurs all the time.

    Then again, in this case I think the problem is the Me reference in the controlsource. You would just use the field name as long as it's part of the form recordsource, which I guess it is otherwise you would not have thought to use Me. So removing me should work.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. How to bound 2-controls n a Form?
    By djclinton15 in forum Forms
    Replies: 1
    Last Post: 12-05-2015, 03:32 PM
  2. How to go to record in bound form
    By ittechguy in forum Forms
    Replies: 6
    Last Post: 11-17-2015, 06:23 PM
  3. Replies: 6
    Last Post: 01-30-2014, 05:57 PM
  4. Bound form with bound combobox
    By Jerry8989 in forum Access
    Replies: 2
    Last Post: 12-05-2011, 01:50 PM
  5. Replies: 0
    Last Post: 05-09-2010, 08:43 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