M
Mario
What expression do I need to use in a textbox so that when
I run the report it displays the name of the table?
Thanks...
I run the report it displays the name of the table?
Thanks...
What expression do I need to use
in a textbox so that when I run the
report it displays the name of the
table?
-----Original Message-----
The record source is a report property that can be displayed with a simple
text box with a control source of:
=[Recordsource]
This will also work with [Filter] and other report properties.
--
Duane Hookom
MS Access MVP
Larry Linson said:"Mario" wrote
If, by "the table", you mean that you have a Table as the Record Source of
the Report and you want to print its name, then
where txtX is the name of the Text Box, you can put in the Print event of
the section of the report that contains txtX
Me!txtX = Me.RecordSource
Or, if you prefer, if rptR is the name of the Report, you can put the
following in the Control Source of the Text Box:
= Reports!rptR.RecordSource
But, if you used the Wizard to create the Report, you may actually have an
SQL statement as the RecordSource. If so, that's what will be printed.
Larry Linson
Microsoft Access MVP
.
Mario said:Thanks for your responses. I failed to mention that the
report runs a query to display the data from the table.
Therefore, using =recordsource displays the name of the
query instead of the name of the table. Under these
conditions, is there still a way to display the name of
the table? Thanks a lot...
-----Original Message-----
The record source is a report property that can be displayed with a simple
text box with a control source of:
=[Recordsource]
This will also work with [Filter] and other report properties.
--
Duane Hookom
MS Access MVP
Larry Linson said:"Mario" wrote
What expression do I need to use
in a textbox so that when I run the
report it displays the name of the
table?
If, by "the table", you mean that you have a Table as the Record Source of
the Report and you want to print its name, then
where txtX is the name of the Text Box, you can put in the Print event of
the section of the report that contains txtX
Me!txtX = Me.RecordSource
Or, if you prefer, if rptR is the name of the Report, you can put the
following in the Control Source of the Text Box:
= Reports!rptR.RecordSource
But, if you used the Wizard to create the Report, you may actually have an
SQL statement as the RecordSource. If so, that's what will be printed.
Larry Linson
Microsoft Access MVP
.
Mario said:Thanks for your responses. I failed to mention that the
report runs a query to display the data from the table.
Therefore, using =recordsource displays the name of the
query instead of the name of the table. Under these
conditions, is there still a way to display the name of
the table? Thanks a lot...
-----Original Message-----
The record source is a report property that can be displayed with a simple
text box with a control source of:
=[Recordsource]
This will also work with [Filter] and other report properties.
--
Duane Hookom
MS Access MVP
Larry Linson said:"Mario" wrote
What expression do I need to use
in a textbox so that when I run the
report it displays the name of the
table?
If, by "the table", you mean that you have a Table as the Record Source of
the Report and you want to print its name, then
where txtX is the name of the Text Box, you can put in the Print event of
the section of the report that contains txtX
Me!txtX = Me.RecordSource
Or, if you prefer, if rptR is the name of the Report, you can put the
following in the Control Source of the Text Box:
= Reports!rptR.RecordSource
But, if you used the Wizard to create the Report, you may actually have an
SQL statement as the RecordSource. If so, that's what will be printed.
Larry Linson
Microsoft Access MVP
.
-----Original Message-----
What is "_the_ table"? A query may have many tables as data sources? If, in
fact, it displays the name of the Query, you'd have to write code that
parsed the .SQL property of that Query to try to find the table you want. I
think it would be possible, maybe even relatively simple, to find the first
reference to a table in most SELECT queries.
But, unless this Report is going to be run using different Queries that
refer to different Tables, the very simplest way is to type in the Table
name in a Label Control. If the same Report _can_ be run against different
Tables, then it's likely time for a careful revisit to your Table Design.
Larry Linson
Microsoft Access MVP
Thanks for your responses. I failed to mention that the
report runs a query to display the data from the table.
Therefore, using =recordsource displays the name of the
query instead of the name of the table. Under these
conditions, is there still a way to display the name of
the table? Thanks a lot...
in-----Original Message-----
The record source is a report property that can be displayed with a simple
text box with a control source of:
=[Recordsource]
This will also work with [Filter] and other report properties.
--
Duane Hookom
MS Access MVP
"Mario" wrote
What expression do I need to use
in a textbox so that when I run the
report it displays the name of the
table?
If, by "the table", you mean that you have a Table as the Record Source of
the Report and you want to print its name, then
where txtX is the name of the Text Box, you can put
the Print event ofthe section of the report that contains txtX
Me!txtX = Me.RecordSource
Or, if you prefer, if rptR is the name of the Report, you can put the
following in the Control Source of the Text Box:
= Reports!rptR.RecordSource
But, if you used the Wizard to create the Report, you may actually have an
SQL statement as the RecordSource. If so, that's what will be printed.
Larry Linson
Microsoft Access MVP
.
.