I have table containing a foreign key, contacttypeid. The table store the value 1, for example. The translation for 1 is found in Contact types table in the contactname field. How do I retrieve the value from the other table and place it on my report?
In the underlying query to your report link in the table & include the field.
From the sounds of your question you may not be aware that any report you have has either a table or query for the data source. If you open the report in design mode & open the properties box for the report you will see an item record source, which in your case will probably be the name of a table. You can either change this to the name of a query you have previously created & saved or you can create a query from within the report.
Hi,
You can also use a DLookup function without changing your query. Here is an example of the "control source" for the information you want to add to the report:
This example presumes the table is called tblContactTypes,
- the field is called Contacttypeid
- and the field on the report to be used to link is txtContacttypeid
=DLookUp([Contacttypeid]","tblContactTypes","[Contacttypeid]='" & [txtContacttypeid] & "'"
In case you need it, here is an example of a DCount function, which is placed in the control source for a text box:
=DCount("[SSN]","tblPersonnel" 'counts the number of SSN's found inside the tblPersonnel table HTH,
Randy Smith
California Teachers Association
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.