Access Forms 2003

Posted on 2012-09-12
Last Modified: 2012-09-12
This very simple but I have forgotten how. I have 2 tables that are related on a 1 to many basis. On a form for the Many side you key in a company code and I wish to show the data from the One side of the company name. I have achieved this using a combo box but you get drop down arrows etc. So looking for a much tidier way of displaying the detail from the table. ie say using a text box.

ie  "company code"            show company name
Question by:Photobudy
    LVL 61

    Accepted Solution

    Try adding a textbox to your form and use the following as its control source (include the = sign):

    If company code is text, try this:
    = DLookup("[CompanyName]", "[CompanyTable]", "CompanyCode = '" & [CompanyCode] & "'")

    If company code is numeric, try this:
    = DLookup("[CompanyName]", "[CompanyTable]", "CompanyCode = " & [CompanyCode] )

    You'll have to adjust either of those to use the control, table and field names that are in your database.

    Jim Dettman's article explains this well:

    Author Closing Comment

    very quick, works a treat, many thanks

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
    Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
    In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    794 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

    15 Experts available now in Live!

    Get 1:1 Help Now