A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Report/Query question



 
 
Thread Tools Display Modes
  #1  
Old May 14th, 2004, 10:18 PM
Al Camp
external usenet poster
 
Posts: n/a
Default Report/Query question

I would like to open a report, and when the report is "closed",
I'd like to open a query.

I have this code:
DoCmd.OpenReport "rptMyReport", acViewPreview
DoCmd.OpenQuery "qryMyQuery"

When the code runs, the report opens in preview, and is
immediately covered over by the query opening.

Is there a way to keep the query from running until the report is
closed. (I'd prefer not to code the opening of the query in the
Report Close event, as other functions use this report also.)

Thanks in advance,
Al Camp


  #2  
Old May 14th, 2004, 10:58 PM
fredg
external usenet poster
 
Posts: n/a
Default Report/Query question

On Fri, 14 May 2004 17:18:51 -0400, Al Camp wrote:

I would like to open a report, and when the report is "closed",
I'd like to open a query.

I have this code:
DoCmd.OpenReport "rptMyReport", acViewPreview
DoCmd.OpenQuery "qryMyQuery"

When the code runs, the report opens in preview, and is
immediately covered over by the query opening.

Is there a way to keep the query from running until the report is
closed. (I'd prefer not to code the opening of the query in the
Report Close event, as other functions use this report also.)

Thanks in advance,
Al Camp


If your version of Access supports opening a report in dialog:
DoCmd.OpenReport "ReportName", acViewPreview, , , acDialog
DoCmd.OpenQuery "QueryName"

You'll need to close the report using the Report's close (X) button.
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
  #3  
Old May 14th, 2004, 11:50 PM
Al Camp
external usenet poster
 
Posts: n/a
Default Report/Query question

Fred,
Alas, I'm using Access2K, so acDialog is not an option.
You know, I was really surprised that Access would allow the
query to run at all... until the report closed. Seems to me that
the report should maintain focus (control) of the code until it
is closed.
Well, perhaps someone else will have an idea...
Thanks for your reply.
Al Camp

"fredg" wrote in message
.. .
On Fri, 14 May 2004 17:18:51 -0400, Al Camp wrote:

I would like to open a report, and when the report is

"closed",
I'd like to open a query.

I have this code:
DoCmd.OpenReport "rptMyReport", acViewPreview
DoCmd.OpenQuery "qryMyQuery"

When the code runs, the report opens in preview, and is
immediately covered over by the query opening.

Is there a way to keep the query from running until the

report is
closed. (I'd prefer not to code the opening of the query in

the
Report Close event, as other functions use this report also.)

Thanks in advance,
Al Camp


If your version of Access supports opening a report in dialog:
DoCmd.OpenReport "ReportName", acViewPreview, , , acDialog
DoCmd.OpenQuery "QueryName"

You'll need to close the report using the Report's close (X)

button.
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.



  #4  
Old May 15th, 2004, 04:24 AM
tina
external usenet poster
 
Posts: n/a
Default Report/Query question

well, you could create a public variable, as
Public blnOpenQuery As Boolean

change
DoCmd.OpenReport "rptMyReport", acViewPreview
DoCmd.OpenQuery "qryMyQuery"
to
DoCmd.OpenReport "rptMyReport", acViewPreview
blnOpenQuery = True

in the report's OnClose event, add the following code, as

If blnOpenQuery Then
blnOpenQuery = False
DoCmd.OpenQuery "qryMyQuery"
End If

when you open the report from another function, blnOpenQuery won't be True,
so the query won't open when the report closes.

hth


"Al Camp" wrote in message
...
Fred,
Alas, I'm using Access2K, so acDialog is not an option.
You know, I was really surprised that Access would allow the
query to run at all... until the report closed. Seems to me that
the report should maintain focus (control) of the code until it
is closed.
Well, perhaps someone else will have an idea...
Thanks for your reply.
Al Camp

"fredg" wrote in message
.. .
On Fri, 14 May 2004 17:18:51 -0400, Al Camp wrote:

I would like to open a report, and when the report is

"closed",
I'd like to open a query.

I have this code:
DoCmd.OpenReport "rptMyReport", acViewPreview
DoCmd.OpenQuery "qryMyQuery"

When the code runs, the report opens in preview, and is
immediately covered over by the query opening.

Is there a way to keep the query from running until the

report is
closed. (I'd prefer not to code the opening of the query in

the
Report Close event, as other functions use this report also.)

Thanks in advance,
Al Camp


If your version of Access supports opening a report in dialog:
DoCmd.OpenReport "ReportName", acViewPreview, , , acDialog
DoCmd.OpenQuery "QueryName"

You'll need to close the report using the Report's close (X)

button.
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.





  #5  
Old May 16th, 2004, 04:46 PM
Al Camp
external usenet poster
 
Posts: n/a
Default Report/Query question


"tina" wrote in message
news
well, you could create a public variable, as
Public blnOpenQuery As Boolean

change
DoCmd.OpenReport "rptMyReport", acViewPreview
DoCmd.OpenQuery "qryMyQuery"
to
DoCmd.OpenReport "rptMyReport", acViewPreview
blnOpenQuery = True

in the report's OnClose event, add the following code, as

If blnOpenQuery Then
blnOpenQuery = False
DoCmd.OpenQuery "qryMyQuery"
End If

when you open the report from another function, blnOpenQuery
won't be True,
so the query won't open when the report closes.

hth


"Al Camp" wrote in message
...
Fred,
Alas, I'm using Access2K, so acDialog is not an option.
You know, I was really surprised that Access would allow

the
query to run at all... until the report closed. Seems to me

that
the report should maintain focus (control) of the code until

it
is closed.
Well, perhaps someone else will have an idea...
Thanks for your reply.
Al Camp

"fredg" wrote in message
.. .
On Fri, 14 May 2004 17:18:51 -0400, Al Camp wrote:

I would like to open a report, and when the report is

"closed",
I'd like to open a query.

I have this code:
DoCmd.OpenReport "rptMyReport", acViewPreview
DoCmd.OpenQuery "qryMyQuery"

When the code runs, the report opens in preview, and is
immediately covered over by the query opening.

Is there a way to keep the query from running until the

report is
closed. (I'd prefer not to code the opening of the query

in
the
Report Close event, as other functions use this report

also.)

Thanks in advance,
Al Camp

If your version of Access supports opening a report in

dialog:
DoCmd.OpenReport "ReportName", acViewPreview, , , acDialog
DoCmd.OpenQuery "QueryName"

You'll need to close the report using the Report's close

(X)
button.
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.







  #6  
Old May 16th, 2004, 04:55 PM
Al Camp
external usenet poster
 
Posts: n/a
Default Report/Query question

Thanks Tina,
I'll give that a try, but I did want to avoid using report
code to solve the problem.
Can't believe there isn't a more "simple" solution...
I may try reposting...
Thanks again,
Al Camp


"tina" wrote in message
news
well, you could create a public variable, as
Public blnOpenQuery As Boolean

change
DoCmd.OpenReport "rptMyReport", acViewPreview
DoCmd.OpenQuery "qryMyQuery"
to
DoCmd.OpenReport "rptMyReport", acViewPreview
blnOpenQuery = True

in the report's OnClose event, add the following code, as

If blnOpenQuery Then
blnOpenQuery = False
DoCmd.OpenQuery "qryMyQuery"
End If

when you open the report from another function, blnOpenQuery
won't be True,
so the query won't open when the report closes.

hth


"Al Camp" wrote in message
...
Fred,
Alas, I'm using Access2K, so acDialog is not an option.
You know, I was really surprised that Access would allow

the
query to run at all... until the report closed. Seems to me

that
the report should maintain focus (control) of the code until

it
is closed.
Well, perhaps someone else will have an idea...
Thanks for your reply.
Al Camp

"fredg" wrote in message
.. .
On Fri, 14 May 2004 17:18:51 -0400, Al Camp wrote:

I would like to open a report, and when the report is

"closed",
I'd like to open a query.

I have this code:
DoCmd.OpenReport "rptMyReport", acViewPreview
DoCmd.OpenQuery "qryMyQuery"

When the code runs, the report opens in preview, and is
immediately covered over by the query opening.

Is there a way to keep the query from running until the

report is
closed. (I'd prefer not to code the opening of the query

in
the
Report Close event, as other functions use this report

also.)

Thanks in advance,
Al Camp

If your version of Access supports opening a report in

dialog:
DoCmd.OpenReport "ReportName", acViewPreview, , , acDialog
DoCmd.OpenQuery "QueryName"

You'll need to close the report using the Report's close

(X)
button.
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.







 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:15 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.