Referencing report in Current db vs Library

B

Bobness3

I have an Access library which is referenced in my current db (Access97).
Both databases contain a report of the same name - ie: "rptSummary". When
calling a Sub from the current db, passing as an argument the name of the
report to print, it always references the one in the library. I have tried
using the statement "set db = currentdb" in the calling routine, but it
always goes the report in the library.

Is there any way to specifically refer to the report in the current database?

Thx
Bob
 
B

Bobness3 via AccessMonster.com

Alex said:
Hi,
I think you need to have reports with different names, what is a reason that
you made reports with same name?
I have an Access library which is referenced in my current db (Access97).
Both databases contain a report of the same name - ie: "rptSummary". When
[quoted text clipped - 9 lines]

It is a name which is commonly used in our environment, so I'm hoping to find
a way to specifically reference the report in the "current" db rather than
the "code" (or library) database.

Thanks
Bob
 
T

Tony Toews [MVP]

Bobness3 said:
I have an Access library which is referenced in my current db (Access97).
Both databases contain a report of the same name - ie: "rptSummary". When
calling a Sub from the current db, passing as an argument the name of the
report to print, it always references the one in the library. I have tried
using the statement "set db = currentdb" in the calling routine, but it
always goes the report in the library.

Is there any way to specifically refer to the report in the current database?

FWIW the help for the OpenReport Action states exactly the situation
you mention.

"The name of the report to open. The Report Name box in the Action
Arguments section of the Macro window shows all reports in the current
database. This is a required argument.

If you run a macro containing the OpenReport action in a library
database, Microsoft Access looks for the report with this name first
in the library database, then in the current database."

So unless someone else has any wild ideas you're going to have to
change the report name in the CodeDB.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
B

Bobness3 via AccessMonster.com

Well then, I guess the ultimate solution would be to prefix the report names
in the library with something like "lib_..." to minimize the chances of
having the same report name in the current db.

Thank you
Bob

I have an Access library which is referenced in my current db (Access97).
Both databases contain a report of the same name - ie: "rptSummary". When
[quoted text clipped - 4 lines]
Is there any way to specifically refer to the report in the current database?

FWIW the help for the OpenReport Action states exactly the situation
you mention.

"The name of the report to open. The Report Name box in the Action
Arguments section of the Macro window shows all reports in the current
database. This is a required argument.

If you run a macro containing the OpenReport action in a library
database, Microsoft Access looks for the report with this name first
in the library database, then in the current database."

So unless someone else has any wild ideas you're going to have to
change the report name in the CodeDB.

Tony
 
T

Tony Toews [MVP]

Bobness3 via AccessMonster.com said:
Well then, I guess the ultimate solution would be to prefix the report names
in the library with something like "lib_..." to minimize the chances of
having the same report name in the current db.

or Bob. <smile>

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
D

david

I think
Docmd SelectObject,
then
RunCmd PrintPreview

But we call Reports in a database by calling a function in that database.

(david)
 

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