REPORTS

L

LOUIS

I am using access 2003

I have many reports and I want to display to each report the
Company name i.e" COMPANY ABC"
One easy way is to use the Label . But is a hell of job.
I create a table (TplCompanyName) with one record
but I do not know how to retrieve that record on my reports.

I use the textbox (=TplCompanyName![Name]) and I am getting the error
#Name?

Any Ideas??
 
T

tina

first suggestion: don't use the word Name, to name anything that you name
in the database - fields, tables, queries, forms, controls in forms,
reports, controls in reports, macros, modules...you get the idea. Name is a
Reserved word in Access; using a reserved word as the name of something is
going to cause problems, which are often hard to trace back to that root
cause. a simple way to avoid using a reserved word as the name of a field in
any table - without having to check all names against a Reserved Words
list - is to use a prefix on all fieldnames. for instance, to name all the
fields in TplCompanyName, i might prefix all fields names with cn, as

cnName

instead of just

Name

and to answer your immediate question: to look up a table value that isn't
part of the object's (form or report) RecordSource, you can use the
DLookup() function, as

=DLookup("cnName", "TplCompanyName")

recommend you read up on the DLookup() function in Access Help, so you'll
understand how it works.

hth
 
H

huangda 晋江兴达机械

LOUIS said:
I am using access 2003

I have many reports and I want to display to each report the
Company name i.e" COMPANY ABC"
One easy way is to use the Label . But is a hell of job.
I create a table (TplCompanyName) with one record
but I do not know how to retrieve that record on my reports.

I use the textbox (=TplCompanyName![Name]) and I am getting the error
#Name?

Any Ideas??
 
J

John Spencer

Another idea is to design a report to be used as an unlinked subreport
on every report. I do this for some of my databases that require the
same information in every page footer or in every report footer or header.

Usually that is something like a logo, some specific information on the
organization, and perhaps a legal warning on the sensitivity or use of
the information in the report. This is especially nice if the
organization changes its logo, or the warning, or its name. All you
have to do to fix the reports to conform with the new information is to
modify the one report that is a sub-report. Now every report that uses
the report as a sub-report conforms to the new standard.

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top