473,473 Members | 1,548 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Re: Opening report in another db

"dpcman01" <bo*@dpcman.com.auwrote in
news:48***********************@news.optusnet.com.a u:
Sorry, I posted the previous message in haste without sufficient
checking. I rechecked Dev's code and found that I'd omitted the second
apiShowWindow call.
So now the report opens fine, but with the built in menubar and
toolbar instead of my custom Menubar.
The custom one is there when I open the ReportLibrary.mdb directly,
but not when opened from from this code.
So I added the line:
.Reports("rCheque").MenuBar = "DPCPreview" after opening the
report.
Now I find that it still opens without the custom menubar, but if I
right click anywhere on the screen, the custom menu appears and the
built in ones vanish.
Has anyone else experienced this problem?
Much of the code at the MVP site gave excellent results last century.

If I were opening a report in another db I would
(using Northwind 2007.accdb as an example)
1. Write a procedure in that db as:

Public Function OpenEmployeesPhoneBookReport()
DoCmd.OpenReport "Employee Phone Book", acViewPreview
End Function

2. Set a reference to that db from the current/home db (the db in which I
will be working);

3. Write a function in the current/home db (the db in which I will be
working) as:

Public Function OpenNorthwind2007EmployeesPhoneBookReport()
[Northwind 2007].OpenEmployeesPhoneBookReport
End Function

I can think of three advantages of this method:
1. AutoExec Macros and Startup Forms in the referenced db are not run;
2. The referenced db does not have to be closed;
3. There may be less chance of confusing the two dbs as there is when we
create a new instance of the Access application.

--
lyle fairfield
Oct 2 '08 #1
6 2094
Ah, good to see you, Lyle, and to see you in good form, as well -- keeping
up with the times. BTW, how's your Y3K Consulting offering going? Mine is,
to be honest, a "slow sell".

Larry

"lyle fairfield" <ly******@yah00.cawrote in message
news:Xn**********************@216.221.81.119...
"dpcman01" <bo*@dpcman.com.auwrote in
news:48***********************@news.optusnet.com.a u:
>Sorry, I posted the previous message in haste without sufficient
checking. I rechecked Dev's code and found that I'd omitted the second
apiShowWindow call.
So now the report opens fine, but with the built in menubar and
toolbar instead of my custom Menubar.
The custom one is there when I open the ReportLibrary.mdb directly,
but not when opened from from this code.
So I added the line:
.Reports("rCheque").MenuBar = "DPCPreview" after opening the
report.
Now I find that it still opens without the custom menubar, but if I
right click anywhere on the screen, the custom menu appears and the
built in ones vanish.
Has anyone else experienced this problem?

Much of the code at the MVP site gave excellent results last century.

If I were opening a report in another db I would
(using Northwind 2007.accdb as an example)
1. Write a procedure in that db as:

Public Function OpenEmployeesPhoneBookReport()
DoCmd.OpenReport "Employee Phone Book", acViewPreview
End Function

2. Set a reference to that db from the current/home db (the db in which I
will be working);

3. Write a function in the current/home db (the db in which I will be
working) as:

Public Function OpenNorthwind2007EmployeesPhoneBookReport()
[Northwind 2007].OpenEmployeesPhoneBookReport
End Function

I can think of three advantages of this method:
1. AutoExec Macros and Startup Forms in the referenced db are not run;
2. The referenced db does not have to be closed;
3. There may be less chance of confusing the two dbs as there is when we
create a new instance of the Access application.

--
lyle fairfield

Oct 2 '08 #2
Thanks Lyle,
I'd already been down that track, but couldn't get it to work from
distributed Access 2002 mde's.
The problem was finding the path to the reference when installed on
different user systems, since the reference can't be changed in an mde at
runtime.
Some users have stand-alone PC's and others are using Win2003 Server with
TS.
Do you have any ideas to overcome this reference addressing issue?
--
Bob Darlington
Brisbane
"lyle fairfield" <ly******@yah00.cawrote in message
news:Xn**********************@216.221.81.119...
"dpcman01" <bo*@dpcman.com.auwrote in
news:48***********************@news.optusnet.com.a u:
>Sorry, I posted the previous message in haste without sufficient
checking. I rechecked Dev's code and found that I'd omitted the second
apiShowWindow call.
So now the report opens fine, but with the built in menubar and
toolbar instead of my custom Menubar.
The custom one is there when I open the ReportLibrary.mdb directly,
but not when opened from from this code.
So I added the line:
.Reports("rCheque").MenuBar = "DPCPreview" after opening the
report.
Now I find that it still opens without the custom menubar, but if I
right click anywhere on the screen, the custom menu appears and the
built in ones vanish.
Has anyone else experienced this problem?

Much of the code at the MVP site gave excellent results last century.

If I were opening a report in another db I would
(using Northwind 2007.accdb as an example)
1. Write a procedure in that db as:

Public Function OpenEmployeesPhoneBookReport()
DoCmd.OpenReport "Employee Phone Book", acViewPreview
End Function

2. Set a reference to that db from the current/home db (the db in which I
will be working);

3. Write a function in the current/home db (the db in which I will be
working) as:

Public Function OpenNorthwind2007EmployeesPhoneBookReport()
[Northwind 2007].OpenEmployeesPhoneBookReport
End Function

I can think of three advantages of this method:
1. AutoExec Macros and Startup Forms in the referenced db are not run;
2. The referenced db does not have to be closed;
3. There may be less chance of confusing the two dbs as there is when we
create a new instance of the Access application.

--
lyle fairfield

Oct 2 '08 #3

"dpcman01" <bo*@dpcman.com.auwrote in
news:48**********************@news.optusnet.com.au :

Do you have any ideas to overcome this reference addressing issue?
No, not under the circumstances you describe.

But how to show the report?

My code (below) works but not flawlessly.

I think I would import the report into the user db and find some way to
link to the tables, views or whatever on which it is based.

As a last resort I'd create a db with only that report and an autoexec
macro which opened the report (and a link to the data) in it. In the
reports closing code I'd put:
Quit.
So ... open the db and the report shows.
Close the report and the db closes.

and open the report db with whatever command is appropriate in your
working db.

----------------------------------
.... this is quite gnarly in my opinion.

Private Declare Function ShowWindow& Lib "user32" _
(ByVal hwnd&, ByVal ShowCommand&)
Declare Function SetForegroundWindow& Lib "user32" _
(ByVal hwnd&)
Const Maximized& = 3
Dim AccessApplication As Access.Application

Public Function OpenExtraneousReport( _
ByVal Database$, _
ByVal Report$)
If AccessApplication Is Nothing Then _
Set AccessApplication = GetObject(Database)
With AccessApplication
ShowWindow .hWndAccessApp, Maximized
SetForegroundWindow .hWndAccessApp
.DoCmd.OpenReport Report, acViewPreview
End With
End Function

Sub test()
OpenExtraneousReport "Northwind 2007.accdb", "Employee Phone Book"
End Sub

--
lyle fairfield
Oct 3 '08 #4
Sky
"dpcman01" <bo*@dpcman.com.auwrote in message
news:48**********************@news.optusnet.com.au ...
Thanks Lyle,
I'd already been down that track, but couldn't get it to work from
distributed Access 2002 mde's.
The problem was finding the path to the reference when installed on
different user systems, since the reference can't be changed in an mde at
runtime.
Some users have stand-alone PC's and others are using Win2003 Server with
TS.
Do you have any ideas to overcome this reference addressing issue?
--
Bob Darlington
Brisbane
If you install the referenced library database .mde file in the same folder
as the front-end application .mde, then the front-end will find and
reference the library database automatically, even if it was compiled in a
different path on the developer's computer. I have used this feature in both
Access 2000 and 2003. I would expect it works the same way in Access 2002.

Another option is to create the RefLibPaths registry entry, but that has
proved more troublesome for me, especially if you install more than one
application on the same customer computer.

- Steve
Oct 3 '08 #5
Thanks Steve and Lyle.
I'll let you know the outcome.

--
Bob Darlington
Brisbane
"dpcman01" <bo*@dpcman.com.auwrote in message
news:48**********************@news.optusnet.com.au ...
Thanks Lyle,
I'd already been down that track, but couldn't get it to work from
distributed Access 2002 mde's.
The problem was finding the path to the reference when installed on
different user systems, since the reference can't be changed in an mde at
runtime.
Some users have stand-alone PC's and others are using Win2003 Server with
TS.
Do you have any ideas to overcome this reference addressing issue?
--
Bob Darlington
Brisbane
"lyle fairfield" <ly******@yah00.cawrote in message
news:Xn**********************@216.221.81.119...
>"dpcman01" <bo*@dpcman.com.auwrote in
news:48***********************@news.optusnet.com. au:
>>Sorry, I posted the previous message in haste without sufficient
checking. I rechecked Dev's code and found that I'd omitted the second
apiShowWindow call.
So now the report opens fine, but with the built in menubar and
toolbar instead of my custom Menubar.
The custom one is there when I open the ReportLibrary.mdb directly,
but not when opened from from this code.
So I added the line:
.Reports("rCheque").MenuBar = "DPCPreview" after opening the
report.
Now I find that it still opens without the custom menubar, but if I
right click anywhere on the screen, the custom menu appears and the
built in ones vanish.
Has anyone else experienced this problem?

Much of the code at the MVP site gave excellent results last century.

If I were opening a report in another db I would
(using Northwind 2007.accdb as an example)
1. Write a procedure in that db as:

Public Function OpenEmployeesPhoneBookReport()
DoCmd.OpenReport "Employee Phone Book", acViewPreview
End Function

2. Set a reference to that db from the current/home db (the db in which I
will be working);

3. Write a function in the current/home db (the db in which I will be
working) as:

Public Function OpenNorthwind2007EmployeesPhoneBookReport()
[Northwind 2007].OpenEmployeesPhoneBookReport
End Function

I can think of three advantages of this method:
1. AutoExec Macros and Startup Forms in the referenced db are not run;
2. The referenced db does not have to be closed;
3. There may be less chance of confusing the two dbs as there is when we
create a new instance of the Access application.

--
lyle fairfield


Oct 3 '08 #6


--
Bob Darlington
Brisbane
"Sky" <s.young @ stanley associates . comwrote in message
news:fT***************@nwrddc01.gnilink.net...
"dpcman01" <bo*@dpcman.com.auwrote in message
news:48**********************@news.optusnet.com.au ...
>Thanks Lyle,
I'd already been down that track, but couldn't get it to work from
distributed Access 2002 mde's.
The problem was finding the path to the reference when installed on
different user systems, since the reference can't be changed in an mde at
runtime.
Some users have stand-alone PC's and others are using Win2003 Server with
TS.
Do you have any ideas to overcome this reference addressing issue?
--
Bob Darlington
Brisbane

If you install the referenced library database .mde file in the same
folder as the front-end application .mde, then the front-end will find and
reference the library database automatically, even if it was compiled in a
different path on the developer's computer. I have used this feature in
both Access 2000 and 2003. I would expect it works the same way in Access
2002.

Another option is to create the RefLibPaths registry entry, but that has
proved more troublesome for me, especially if you install more than one
application on the same customer computer.

- Steve

Steve,
I followed your advice and loaded the referenced mde in the same folder as
the front end mde, but get an error message indicating that there is a
missing reference (ie "The expression you entered has a function that ...
can't find" .
If I load the front end as an mdb, there's no problem, but my distributed
app needs to be an mde.
I might need to look at your second suggestion with RefLibPaths, but here
again, couldn't I expect to have the same problem from an mde front end?
Oct 3 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: D. Alvarado | last post by:
Hello, I am trying to open a window containing an image and I would like the image to be flush against the window -- i.e. have no padding or border. Can I make this happen with a single call to a...
1
by: Andrew | last post by:
Hi All: I am using Access2000 and I find that the command to open an Access report in preview mode is very slow: DoCmd.OpenReport rptABC, acViewPreview, "", "" The scenario is this: - The...
1
by: N. Graves | last post by:
Hi, I want to have a Search Dialog box that has several text box and fields to build a search and display the results in a form. I can do everything that I need to if I us a report but I would...
3
by: Greg | last post by:
On my report I want to have an opening balance signifying all transactions up to the month selected and detailed transactions for the month selected and then a closing blance. I'm perpelexed...
11
by: Colin Mardell | last post by:
Can anyone tell me what is wrong with the following? Whatever I do the report brings back all records in the table, rather than just those between the dates specified. Dim strDocName As String...
2
by: Prakash | last post by:
I have 2 tables ... Customer_Master: Cust-Code, Cust_Name Customer_Transactions: Cust_Code, Date, Details, Debit, Credit I would like to generate a report in the foll manner, say from...
3
stonward
by: stonward | last post by:
Hi Guys, I have a main form, based on a query, with a subform based on another, that is used primarily for data input. The whole thing is my QUOTATION form. I want to print (view first) this, and...
0
by: bbrewder | last post by:
I am struggling with some MSAccess automation issues. Basically, we have a .Net application that uses MSAccess for reporting (legacy code). We are able to launch MSAccess fine and even work with...
3
by: Paul H | last post by:
I have a transactions table and a balance table that look something like this: tblTransactions TransactionID (PK Autonumber) ClientID TransactionDate TransactionAmount (currency field, values...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.