Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Access Forms 2003

Posted on 2012-09-12
2
Medium Priority
?
370 Views
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
0
Comment
Question by:John Pike
2 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 1600 total points
ID: 38391157
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:
http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_12-Dlookup-and-the-Domain-Functions.html
0
 

Author Closing Comment

by:John Pike
ID: 38391356
very quick, works a treat, many thanks
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
A quick solution showing how to control and open a POS Cash Register Drawer using VBA with MS Access.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

564 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