Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report field displays record number rather then the item

Status
Not open for further replies.

varich

Technical User
Aug 26, 2009
17
US
I am working on developing a database to handle transfers of patients from community hospitals to our hospital. I have a report that contains data, including one field that should display the hospital name. Instead of displaying the hospital name, it displays the record ID number for the specific hospital instead. How do I get it to display the hospital name, rather than the record number.
 

What is the code behind the query the report is based on?


Randy
 
If the query returns the name, choose that field as the text box data source. If not, add it to the query, or have a look at the DLookup() function.

Cogito eggo sum – I think, therefore I am a waffle.
 
I expect varich has lookup fields defined in his table(s). Many of us old-timers consider this bad practice. The solution is to: 1) not use lookup fields 2) add the table with the name into the report's record source.

I would not use DLookup() if at all possible.

Duane
Hook'D on Access
MS Access MVP
 
I used the create buttons to create the tables, queries, forms and reports. I’m not sure what the underlying code is. The hospital table is a lookup table. So this is what I did, I created a table to store transfer data for each transfer patient, including the hosptial they are coming from. This information is put into the transfer table via a form. The hospital table contains a list of 200 hospitals. The field on the form to select the hospital is a drop down field that displays the hospitals. Everything seems to work just fine, the form works, the data goes into the right tables, but the two items that are drop down items display the record number and not the name of the hospital.
 
You must open your report in design view and find its record source property. Go to the query design of the record source and add the Hospital table one or more times (once for each field related to the table). Join the appropriate fields and add the hospital name(s) to the query grid so it is available in your report.

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top