DLookup in the Control Source Property of a Form Text Box

Posted on 2004-11-24
Last Modified: 2012-05-05
This is what I have in the Control Source

=DLookUp([Optic Description],[Optics],[Optics]!OpticID=[Top Optics])

but it gives me: #Name?

I am trying to look up a description from the Optics table where The OptiicID is the same as the current displayed record on the form.

Question by:galneweinhaw
    LVL 15

    Expert Comment

    Try :

    =DLookUp("[Optic Description]";"[Optics]";"[Optics] = " & Form![Top Optics])
    LVL 8

    Expert Comment

    Try this:

    =DLookUp("[Optic Description]","[Optics]","[OpticID] = " & Me.[Top Optics])
    LVL 15

    Expert Comment

    Sorry, mistake, here's to good one :

    =DLookUp("[Optic Description]";"[Optics]";"[OpticID] = " & Form![Top Optics])
    LVL 15

    Accepted Solution

    or :

    =DLookUp("[Optic Description]","[Optics]","[OpticID] = " & Form![Top Optics])
    LVL 58

    Assisted Solution


    =DLookUp("[Optic Description]", "Optics", "OpticID=" & [Top Optics])

    (provided [Top Optics] is a control that displays a valid OpticID number)

    Good Luck!
    LVL 58

    Expert Comment

    we have fast typers here :)
    BTW: the semi-colon is valid in a french setup, for example (see the Windows "list separator"), and the "Me." syntax does not work in a control source...

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
    Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
    Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
    In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now