Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lookup field appears as numerical values instead of text on Access report

I am trying to create a report putting a field called contact which has the name of a person. This name is linked directly to another table where I keep all the contacts.

For some strange reason, when I include this name (which in query view displays as the name of the contact), instead of the name appearing, the unique ID number is shown on my report.

like image 249
Marchese Il Chihuahua Avatar asked Jan 21 '14 21:01

Marchese Il Chihuahua


1 Answers

As mentioned in the article cited in the above comment, you can use a Combo Box control on your report to do the lookup for you. To see how this can be done, create a new report based on the table containing the lookup field, then drag and drop that field onto the report. That will create a Combo Box control with properties that look something like this:

Row Source: SELECT [Clients].[ID], [Clients].[LastName] FROM Clients;
Bound Column: 1
Column Count: 2
Column Widths: 0";1"

You could use a similar Combo Box control on your actual report to display the client's name rather than their numeric ID value.

Another alternative would be to change the Control Source of the report's Text Box control to have it do a DLookUp() on the table. If the lookup field is named [client] then changing the Control Source of the Text Box to something like

=DLookUp("LastName","Clients","ID=" & [client])

would also work.

like image 155
Gord Thompson Avatar answered Sep 22 '22 19:09

Gord Thompson