Passing Multiple Parameters from Query to a Report

T

Tommy T

Ken Snell and FredG,

I have been following the thread started 11/13/2002 and have been successful
so far with my report and underlying parameter query however I have a
strange situation occurring on my report. I hope you can help me out.

I created a parameter query with these criteria "between [Enter Start Date:]
and [Enter End Date:]" and based my report on that query which worked fine.
I thought I would make it look a bit more professional by creating a
Query-by-Form that requested both dates. The underlying query parameters
were changed to "Between [Forms]![frmEnterDates2]![txtBegin] And
[Forms]![frmEnterDates2]![txtEnd]" and added a button that calls the report
based on my parameter query. The Query-by-Form and its button worked just
fine. Now I wanted those date ranges printed on the report so the user would
know what dates he or she entered into the Query-by-Form. In the Page Header
I entered into a Text Box ="From " & Forms!frmEnterDates2!txtBegin & " to "
& Forms!frmEnterDates2!txtEnd. The date range prints fine on the first page
but on subsequent pages thereafter it prints #Error. What is going on and
how do I correct the problem?

P.S.: What code would I enter into the button on the Query-by-Form that
calls the report to close the Query-by-Form after the report is rendered on
screen?

Thank you in advance. All assistance will be much appreciated.

TommyT
 
S

SA

Tommy:

The form needs to stay open for the reference to its controls to continue to
work after the first page. If you close the form, then you will see the
#Error, you are receiving. To work around this problem, you can set the
form to become invisible after the report is opened and "re-visible" when it
closes by adding this type of code to the button:

Docmd.OpenReport "YourReport", acViewPreview
While sysCmd(acSysCmdGetObjectState, acReport, "YourReport") = _
acObjStateOpen
Me.Visible=False
Wend
Me.Visible = True
 
T

Tommy T

Hello Steve,

Thanks for responding.
I pasted your code into the button's "OnClick" event as shown below but it
locked up every window I had open in Access.

My code:

Dim stDocName As String

stDocName = "RptDailyTransport"
DoCmd.OpenReport stDocName, acPreview
While SysCmd(acSysCmdGetObjectState, acReport, stDocName) =
acObjStateOpen
Me.Visible = False
Wend
Me.Visible = True

Any Idea?

Tommy "T"

SA said:
Tommy:

The form needs to stay open for the reference to its controls to continue to
work after the first page. If you close the form, then you will see the
#Error, you are receiving. To work around this problem, you can set the
form to become invisible after the report is opened and "re-visible" when it
closes by adding this type of code to the button:

Docmd.OpenReport "YourReport", acViewPreview
While sysCmd(acSysCmdGetObjectState, acReport, "YourReport") = _
acObjStateOpen
Me.Visible=False
Wend
Me.Visible = True
--
Steve Arbaugh
ACG Soft
http://ourworld.compuserve.com/homepages/attac-cg

Tommy T said:
Ken Snell and FredG,

I have been following the thread started 11/13/2002 and have been successful
so far with my report and underlying parameter query however I have a
strange situation occurring on my report. I hope you can help me out.

I created a parameter query with these criteria "between [Enter Start Date:]
and [Enter End Date:]" and based my report on that query which worked fine.
I thought I would make it look a bit more professional by creating a
Query-by-Form that requested both dates. The underlying query parameters
were changed to "Between [Forms]![frmEnterDates2]![txtBegin] And
[Forms]![frmEnterDates2]![txtEnd]" and added a button that calls the report
based on my parameter query. The Query-by-Form and its button worked just
fine. Now I wanted those date ranges printed on the report so the user would
know what dates he or she entered into the Query-by-Form. In the Page Header
I entered into a Text Box ="From " & Forms!frmEnterDates2!txtBegin & "
to
"
& Forms!frmEnterDates2!txtEnd. The date range prints fine on the first page
but on subsequent pages thereafter it prints #Error. What is going on and
how do I correct the problem?

P.S.: What code would I enter into the button on the Query-by-Form that
calls the report to close the Query-by-Form after the report is rendered on
screen?

Thank you in advance. All assistance will be much appreciated.

TommyT
 
S

SA

Tommy:

I forgot one line in the post. Try this:

stDocName = "RptDailyTransport"
DoCmd.OpenReport stDocName, acPreview
While SysCmd(acSysCmdGetObjectState, acReport, stDocName) = _
acObjStateOpen
Me.Visible = False
DoEvents
Wend
Me.Visible = True
--
Steve Arbaugh
ACG Soft
http://ourworld.compuserve.com/homepages/attac-cg


Tommy T said:
Hello Steve,

Thanks for responding.
I pasted your code into the button's "OnClick" event as shown below but it
locked up every window I had open in Access.

My code:

Dim stDocName As String

stDocName = "RptDailyTransport"
DoCmd.OpenReport stDocName, acPreview
While SysCmd(acSysCmdGetObjectState, acReport, stDocName) =
acObjStateOpen
Me.Visible = False
Wend
Me.Visible = True

Any Idea?

Tommy "T"

SA said:
Tommy:

The form needs to stay open for the reference to its controls to
continue
to
work after the first page. If you close the form, then you will see the
#Error, you are receiving. To work around this problem, you can set the
form to become invisible after the report is opened and "re-visible"
when
it
closes by adding this type of code to the button:

Docmd.OpenReport "YourReport", acViewPreview
While sysCmd(acSysCmdGetObjectState, acReport, "YourReport") = _
acObjStateOpen
Me.Visible=False
Wend
Me.Visible = True
--
Steve Arbaugh
ACG Soft
http://ourworld.compuserve.com/homepages/attac-cg

Tommy T said:
Ken Snell and FredG,

I have been following the thread started 11/13/2002 and have been successful
so far with my report and underlying parameter query however I have a
strange situation occurring on my report. I hope you can help me out.

I created a parameter query with these criteria "between [Enter Start Date:]
and [Enter End Date:]" and based my report on that query which worked fine.
I thought I would make it look a bit more professional by creating a
Query-by-Form that requested both dates. The underlying query parameters
were changed to "Between [Forms]![frmEnterDates2]![txtBegin] And
[Forms]![frmEnterDates2]![txtEnd]" and added a button that calls the report
based on my parameter query. The Query-by-Form and its button worked just
fine. Now I wanted those date ranges printed on the report so the user would
know what dates he or she entered into the Query-by-Form. In the Page Header
I entered into a Text Box ="From " & Forms!frmEnterDates2!txtBegin & "
to
"
& Forms!frmEnterDates2!txtEnd. The date range prints fine on the first page
but on subsequent pages thereafter it prints #Error. What is going on and
how do I correct the problem?

P.S.: What code would I enter into the button on the Query-by-Form that
calls the report to close the Query-by-Form after the report is
rendered
on
screen?

Thank you in advance. All assistance will be much appreciated.

TommyT
 
T

Tommy T

Thanks Steve that did the Trick. Much Thanks.

Tom "T"


SA said:
Tommy:

I forgot one line in the post. Try this:

stDocName = "RptDailyTransport"
DoCmd.OpenReport stDocName, acPreview
While SysCmd(acSysCmdGetObjectState, acReport, stDocName) = _
acObjStateOpen
Me.Visible = False
DoEvents
Wend
Me.Visible = True
--
Steve Arbaugh
ACG Soft
http://ourworld.compuserve.com/homepages/attac-cg


Tommy T said:
Hello Steve,

Thanks for responding.
I pasted your code into the button's "OnClick" event as shown below but it
locked up every window I had open in Access.

My code:

Dim stDocName As String

stDocName = "RptDailyTransport"
DoCmd.OpenReport stDocName, acPreview
While SysCmd(acSysCmdGetObjectState, acReport, stDocName) =
acObjStateOpen
Me.Visible = False
Wend
Me.Visible = True

Any Idea?

Tommy "T"

SA said:
Tommy:

The form needs to stay open for the reference to its controls to
continue
to
work after the first page. If you close the form, then you will see the
#Error, you are receiving. To work around this problem, you can set the
form to become invisible after the report is opened and "re-visible"
when
it
closes by adding this type of code to the button:

Docmd.OpenReport "YourReport", acViewPreview
While sysCmd(acSysCmdGetObjectState, acReport, "YourReport") = _
acObjStateOpen
Me.Visible=False
Wend
Me.Visible = True
--
Steve Arbaugh
ACG Soft
http://ourworld.compuserve.com/homepages/attac-cg

Ken Snell and FredG,

I have been following the thread started 11/13/2002 and have been
successful
so far with my report and underlying parameter query however I have a
strange situation occurring on my report. I hope you can help me out.

I created a parameter query with these criteria "between [Enter Start
Date:]
and [Enter End Date:]" and based my report on that query which worked
fine.
I thought I would make it look a bit more professional by creating a
Query-by-Form that requested both dates. The underlying query parameters
were changed to "Between [Forms]![frmEnterDates2]![txtBegin] And
[Forms]![frmEnterDates2]![txtEnd]" and added a button that calls the
report
based on my parameter query. The Query-by-Form and its button worked just
fine. Now I wanted those date ranges printed on the report so the user
would
know what dates he or she entered into the Query-by-Form. In the Page
Header
I entered into a Text Box ="From " & Forms!frmEnterDates2!txtBegin &
"
to
"
& Forms!frmEnterDates2!txtEnd. The date range prints fine on the first
page
but on subsequent pages thereafter it prints #Error. What is going
on
and
how do I correct the problem?

P.S.: What code would I enter into the button on the Query-by-Form that
calls the report to close the Query-by-Form after the report is rendered
on
screen?

Thank you in advance. All assistance will be much appreciated.

TommyT
 

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