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 » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Display Parameter from Form on Report



 
 
Thread Tools Display Modes
  #1  
Old July 7th, 2004, 02:32 AM
sara
external usenet poster
 
Posts: n/a
Default Display Parameter from Form on Report

I have a Form to run reports. The field the user inputs
is often needed to display in the report's heading. For
example, the user enters "Week Ending Date" and I pull all
the data for the week using Between WeekEndingdate and
DateAdd -6.

I want to display either BOTH dates, and sometimes just
the one date the user entered in the report heading, and
it always comes up #Name?. I can't find any reference in
Help, either.

=([Forms]![F_PrintEEReports]![getWkMoDate])
(I've tried it with and without the parenthesis)

I can't figure this out!

Thanks,
Sara (newbie to code and forms)
  #2  
Old July 7th, 2004, 04:07 AM
Ken Snell
external usenet poster
 
Posts: n/a
Default Display Parameter from Form on Report

Are you keeping the F_PrintEEReports form open while the report is being
"printed"? If you close it beforehand, the report cannot read the value from
the form's control.

--

Ken Snell
MS ACCESS MVP

"sara" wrote in message
...
I have a Form to run reports. The field the user inputs
is often needed to display in the report's heading. For
example, the user enters "Week Ending Date" and I pull all
the data for the week using Between WeekEndingdate and
DateAdd -6.

I want to display either BOTH dates, and sometimes just
the one date the user entered in the report heading, and
it always comes up #Name?. I can't find any reference in
Help, either.

=([Forms]![F_PrintEEReports]![getWkMoDate])
(I've tried it with and without the parenthesis)

I can't figure this out!

Thanks,
Sara (newbie to code and forms)



  #3  
Old July 7th, 2004, 04:05 PM
sara
external usenet poster
 
Posts: n/a
Default Display Parameter from Form on Report-Interesting

Interesting - that works! You just saved me what would
have been wasted debigging time.

BUT, I was having the problem testing the report on its
own - and the query's parameter was Forms!
F_PrintEEReports...., and I was typing in the date. Why
didn't that date carry through to the report? Does this
mean the users can't run the report from Reports or
Groups - only from the Form if they want the date to
appear?

Thanks so much. I can't tell you how wonderful I find
this community. I am the only person in this company who
does IT/applications, so there's no one to ask!
Sara


-----Original Message-----
Are you keeping the F_PrintEEReports form open while the

report is being
"printed"? If you close it beforehand, the report cannot

read the value from
the form's control.

--

Ken Snell
MS ACCESS MVP

"sara" wrote in

message
...
I have a Form to run reports. The field the user inputs
is often needed to display in the report's heading. For
example, the user enters "Week Ending Date" and I pull

all
the data for the week using Between WeekEndingdate and
DateAdd -6.

I want to display either BOTH dates, and sometimes just
the one date the user entered in the report heading, and
it always comes up #Name?. I can't find any reference

in
Help, either.

=([Forms]![F_PrintEEReports]![getWkMoDate])
(I've tried it with and without the parenthesis)

I can't figure this out!

Thanks,
Sara (newbie to code and forms)



.

  #4  
Old July 8th, 2004, 02:32 AM
Ken Snell
external usenet poster
 
Posts: n/a
Default Display Parameter from Form on Report-Interesting

The Forms reference is interpreted by the report as meaning that actual
form...not the parameter that you passed to the query. The query notes that
the form is not open and asks you for the value; the report notes that the
form is not open and tells you it cannot find the value you want (the error
in the textbox).

Note that a parameter passed to the query is not available to the report
unless you also put that exact same parameter in the control source of a
textbox on the report; then you can "pass" it along.

--

Ken Snell
MS ACCESS MVP

"sara" wrote in message
...
Interesting - that works! You just saved me what would
have been wasted debigging time.

BUT, I was having the problem testing the report on its
own - and the query's parameter was Forms!
F_PrintEEReports...., and I was typing in the date. Why
didn't that date carry through to the report? Does this
mean the users can't run the report from Reports or
Groups - only from the Form if they want the date to
appear?

Thanks so much. I can't tell you how wonderful I find
this community. I am the only person in this company who
does IT/applications, so there's no one to ask!
Sara


-----Original Message-----
Are you keeping the F_PrintEEReports form open while the

report is being
"printed"? If you close it beforehand, the report cannot

read the value from
the form's control.

--

Ken Snell
MS ACCESS MVP

"sara" wrote in

message
...
I have a Form to run reports. The field the user inputs
is often needed to display in the report's heading. For
example, the user enters "Week Ending Date" and I pull

all
the data for the week using Between WeekEndingdate and
DateAdd -6.

I want to display either BOTH dates, and sometimes just
the one date the user entered in the report heading, and
it always comes up #Name?. I can't find any reference

in
Help, either.

=([Forms]![F_PrintEEReports]![getWkMoDate])
(I've tried it with and without the parenthesis)

I can't figure this out!

Thanks,
Sara (newbie to code and forms)



.



  #5  
Old July 15th, 2004, 03:32 AM
Vincent DeLuca
external usenet poster
 
Posts: n/a
Default Display Parameter from Form on Report-Interesting

Ken-

Would the data that is passed from the query that is based upon a parameter text box form be limited to the range specified by the parameter query as shown in a report based upon that query, or would you need to "pass along" the values to limit the data to the range desired within the report itself?

I have successfully created a parameter query based upon form text box data for the desired date range that displays the accurate data, but cannot get a report based upon that query to print. The same report when pulling the same data in which I type in the parameters in popup boxes (based upon a copy of the same query without form references) works fine. I cannot locate the reason for this.

The query with the references to the dialog box form text boxes has the following parameters:

[Forms]![EmployeePullsDialogBox]![StartingDate] Date/Time
[Forms]![EmployeePullsDialogBox]![EndingDate] Date/Time

And in the [Date] column of this crosstab query:

Where

Between [Forms]![EmployeePullsDialogBox]![StartingDate] AND [Forms]![EmployeePullsDialogBox]![EndingDate]

The same form without the dialog box references has the following parameters:

StartingDate Date/Time
EndingDate Date/Time

Why would I be running into this problem?

Thanks.

Vincent DeLuca




"Ken Snell" wrote:

The Forms reference is interpreted by the report as meaning that actual
form...not the parameter that you passed to the query. The query notes that
the form is not open and asks you for the value; the report notes that the
form is not open and tells you it cannot find the value you want (the error
in the textbox).

Note that a parameter passed to the query is not available to the report
unless you also put that exact same parameter in the control source of a
textbox on the report; then you can "pass" it along.

--

Ken Snell
MS ACCESS MVP

"sara" wrote in message
...
Interesting - that works! You just saved me what would
have been wasted debigging time.

BUT, I was having the problem testing the report on its
own - and the query's parameter was Forms!
F_PrintEEReports...., and I was typing in the date. Why
didn't that date carry through to the report? Does this
mean the users can't run the report from Reports or
Groups - only from the Form if they want the date to
appear?

Thanks so much. I can't tell you how wonderful I find
this community. I am the only person in this company who
does IT/applications, so there's no one to ask!
Sara


-----Original Message-----
Are you keeping the F_PrintEEReports form open while the

report is being
"printed"? If you close it beforehand, the report cannot

read the value from
the form's control.

--

Ken Snell
MS ACCESS MVP

"sara" wrote in

message
...
I have a Form to run reports. The field the user inputs
is often needed to display in the report's heading. For
example, the user enters "Week Ending Date" and I pull

all
the data for the week using Between WeekEndingdate and
DateAdd -6.

I want to display either BOTH dates, and sometimes just
the one date the user entered in the report heading, and
it always comes up #Name?. I can't find any reference

in
Help, either.

=([Forms]![F_PrintEEReports]![getWkMoDate])
(I've tried it with and without the parenthesis)

I can't figure this out!

Thanks,
Sara (newbie to code and forms)


.




  #6  
Old July 16th, 2004, 02:07 AM
Ken Snell
external usenet poster
 
Posts: n/a
Default Display Parameter from Form on Report-Interesting

Are you keeping the form open while the report is being generated? You need
to do that.

--

Ken Snell
MS ACCESS MVP

"Vincent DeLuca" wrote in message
...
Ken-

Would the data that is passed from the query that is based upon a

parameter text box form be limited to the range specified by the parameter
query as shown in a report based upon that query, or would you need to "pass
along" the values to limit the data to the range desired within the report
itself?

I have successfully created a parameter query based upon form text box

data for the desired date range that displays the accurate data, but cannot
get a report based upon that query to print. The same report when pulling
the same data in which I type in the parameters in popup boxes (based upon a
copy of the same query without form references) works fine. I cannot locate
the reason for this.

The query with the references to the dialog box form text boxes has the

following parameters:

[Forms]![EmployeePullsDialogBox]![StartingDate] Date/Time
[Forms]![EmployeePullsDialogBox]![EndingDate] Date/Time

And in the [Date] column of this crosstab query:

Where

Between [Forms]![EmployeePullsDialogBox]![StartingDate] AND

[Forms]![EmployeePullsDialogBox]![EndingDate]

The same form without the dialog box references has the following

parameters:

StartingDate Date/Time
EndingDate Date/Time

Why would I be running into this problem?

Thanks.

Vincent DeLuca




"Ken Snell" wrote:

The Forms reference is interpreted by the report as meaning that actual
form...not the parameter that you passed to the query. The query notes

that
the form is not open and asks you for the value; the report notes that

the
form is not open and tells you it cannot find the value you want (the

error
in the textbox).

Note that a parameter passed to the query is not available to the report
unless you also put that exact same parameter in the control source of a
textbox on the report; then you can "pass" it along.

--

Ken Snell
MS ACCESS MVP

"sara" wrote in message
...
Interesting - that works! You just saved me what would
have been wasted debigging time.

BUT, I was having the problem testing the report on its
own - and the query's parameter was Forms!
F_PrintEEReports...., and I was typing in the date. Why
didn't that date carry through to the report? Does this
mean the users can't run the report from Reports or
Groups - only from the Form if they want the date to
appear?

Thanks so much. I can't tell you how wonderful I find
this community. I am the only person in this company who
does IT/applications, so there's no one to ask!
Sara


-----Original Message-----
Are you keeping the F_PrintEEReports form open while the
report is being
"printed"? If you close it beforehand, the report cannot
read the value from
the form's control.

--

Ken Snell
MS ACCESS MVP

"sara" wrote in
message
...
I have a Form to run reports. The field the user inputs
is often needed to display in the report's heading. For
example, the user enters "Week Ending Date" and I pull
all
the data for the week using Between WeekEndingdate and
DateAdd -6.

I want to display either BOTH dates, and sometimes just
the one date the user entered in the report heading, and
it always comes up #Name?. I can't find any reference
in
Help, either.

=([Forms]![F_PrintEEReports]![getWkMoDate])
(I've tried it with and without the parenthesis)

I can't figure this out!

Thanks,
Sara (newbie to code and forms)


.






  #7  
Old July 18th, 2004, 10:37 PM
Vincent DeLuca
external usenet poster
 
Posts: n/a
Default Display Parameter from Form on Report-Interesting

Yes, Ken-

The dialog box form never closes even after the report is closed. The values remain in the text boxes the whole time.

Thanks.

Vincent DeLuca


"Ken Snell" wrote:

Are you keeping the form open while the report is being generated? You need
to do that.

--

Ken Snell
MS ACCESS MVP

"Vincent DeLuca" wrote in message
...
Ken-

Would the data that is passed from the query that is based upon a

parameter text box form be limited to the range specified by the parameter
query as shown in a report based upon that query, or would you need to "pass
along" the values to limit the data to the range desired within the report
itself?

I have successfully created a parameter query based upon form text box

data for the desired date range that displays the accurate data, but cannot
get a report based upon that query to print. The same report when pulling
the same data in which I type in the parameters in popup boxes (based upon a
copy of the same query without form references) works fine. I cannot locate
the reason for this.

The query with the references to the dialog box form text boxes has the

following parameters:

[Forms]![EmployeePullsDialogBox]![StartingDate] Date/Time
[Forms]![EmployeePullsDialogBox]![EndingDate] Date/Time

And in the [Date] column of this crosstab query:

Where

Between [Forms]![EmployeePullsDialogBox]![StartingDate] AND

[Forms]![EmployeePullsDialogBox]![EndingDate]

The same form without the dialog box references has the following

parameters:

StartingDate Date/Time
EndingDate Date/Time

Why would I be running into this problem?

Thanks.

Vincent DeLuca




"Ken Snell" wrote:

The Forms reference is interpreted by the report as meaning that actual
form...not the parameter that you passed to the query. The query notes

that
the form is not open and asks you for the value; the report notes that

the
form is not open and tells you it cannot find the value you want (the

error
in the textbox).

Note that a parameter passed to the query is not available to the report
unless you also put that exact same parameter in the control source of a
textbox on the report; then you can "pass" it along.

--

Ken Snell
MS ACCESS MVP

"sara" wrote in message
...
Interesting - that works! You just saved me what would
have been wasted debigging time.

BUT, I was having the problem testing the report on its
own - and the query's parameter was Forms!
F_PrintEEReports...., and I was typing in the date. Why
didn't that date carry through to the report? Does this
mean the users can't run the report from Reports or
Groups - only from the Form if they want the date to
appear?

Thanks so much. I can't tell you how wonderful I find
this community. I am the only person in this company who
does IT/applications, so there's no one to ask!
Sara


-----Original Message-----
Are you keeping the F_PrintEEReports form open while the
report is being
"printed"? If you close it beforehand, the report cannot
read the value from
the form's control.

--

Ken Snell
MS ACCESS MVP

"sara" wrote in
message
...
I have a Form to run reports. The field the user inputs
is often needed to display in the report's heading. For
example, the user enters "Week Ending Date" and I pull
all
the data for the week using Between WeekEndingdate and
DateAdd -6.

I want to display either BOTH dates, and sometimes just
the one date the user entered in the report heading, and
it always comes up #Name?. I can't find any reference
in
Help, either.

=([Forms]![F_PrintEEReports]![getWkMoDate])
(I've tried it with and without the parenthesis)

I can't figure this out!

Thanks,
Sara (newbie to code and forms)


.







  #8  
Old July 18th, 2004, 11:21 PM
Ken Snell
external usenet poster
 
Posts: n/a
Default Display Parameter from Form on Report-Interesting

Walk me through your process for opening the "dialog" form and for running
the report. Which form is used to open the dialog form? to run the report?
and which code steps are you running and when and in which form/report?

--

Ken Snell
MS ACCESS MVP

"Vincent DeLuca" wrote in message
...
Yes, Ken-

The dialog box form never closes even after the report is closed. The

values remain in the text boxes the whole time.

Thanks.

Vincent DeLuca


"Ken Snell" wrote:

Are you keeping the form open while the report is being generated? You

need
to do that.

--

Ken Snell
MS ACCESS MVP

"Vincent DeLuca" wrote in

message
...
Ken-

Would the data that is passed from the query that is based upon a

parameter text box form be limited to the range specified by the

parameter
query as shown in a report based upon that query, or would you need to

"pass
along" the values to limit the data to the range desired within the

report
itself?

I have successfully created a parameter query based upon form text box

data for the desired date range that displays the accurate data, but

cannot
get a report based upon that query to print. The same report when

pulling
the same data in which I type in the parameters in popup boxes (based

upon a
copy of the same query without form references) works fine. I cannot

locate
the reason for this.

The query with the references to the dialog box form text boxes has

the
following parameters:

[Forms]![EmployeePullsDialogBox]![StartingDate] Date/Time
[Forms]![EmployeePullsDialogBox]![EndingDate] Date/Time

And in the [Date] column of this crosstab query:

Where

Between [Forms]![EmployeePullsDialogBox]![StartingDate] AND

[Forms]![EmployeePullsDialogBox]![EndingDate]

The same form without the dialog box references has the following

parameters:

StartingDate Date/Time
EndingDate Date/Time

Why would I be running into this problem?

Thanks.

Vincent DeLuca




"Ken Snell" wrote:

The Forms reference is interpreted by the report as meaning that

actual
form...not the parameter that you passed to the query. The query

notes
that
the form is not open and asks you for the value; the report notes

that
the
form is not open and tells you it cannot find the value you want

(the
error
in the textbox).

Note that a parameter passed to the query is not available to the

report
unless you also put that exact same parameter in the control source

of a
textbox on the report; then you can "pass" it along.

--

Ken Snell
MS ACCESS MVP

"sara" wrote in message
...
Interesting - that works! You just saved me what would
have been wasted debigging time.

BUT, I was having the problem testing the report on its
own - and the query's parameter was Forms!
F_PrintEEReports...., and I was typing in the date. Why
didn't that date carry through to the report? Does this
mean the users can't run the report from Reports or
Groups - only from the Form if they want the date to
appear?

Thanks so much. I can't tell you how wonderful I find
this community. I am the only person in this company who
does IT/applications, so there's no one to ask!
Sara


-----Original Message-----
Are you keeping the F_PrintEEReports form open while the
report is being
"printed"? If you close it beforehand, the report cannot
read the value from
the form's control.

--

Ken Snell
MS ACCESS MVP

"sara" wrote in
message
...
I have a Form to run reports. The field the user inputs
is often needed to display in the report's heading. For
example, the user enters "Week Ending Date" and I pull
all
the data for the week using Between WeekEndingdate and
DateAdd -6.

I want to display either BOTH dates, and sometimes just
the one date the user entered in the report heading, and
it always comes up #Name?. I can't find any reference
in
Help, either.

=([Forms]![F_PrintEEReports]![getWkMoDate])
(I've tried it with and without the parenthesis)

I can't figure this out!

Thanks,
Sara (newbie to code and forms)


.









  #9  
Old July 19th, 2004, 12:32 AM
Vincent DeLuca
external usenet poster
 
Posts: n/a
Default Display Parameter from Form on Report-Interesting

Ken-

The same Dialog Box is used to call both the query and the report. The same two date input boxes are used for both as well. The user selects any date from a calendar control and clicks a select week button. The code I have written automatically enters the startingdate and the endingdate for the week in the text boxes (or the user can manually enter the dates as well). Then the user may select either a Preview button, a Print button or a Close button. The preview button for now, calls the query and displays it on the screen. Eventually, When the report works, I will do a DoCmd.OpenReport acViewPreview instead of the query for the screen preview. The Print button is supposed to print the report with the same parameters as the Preview button and the query without asking the user for the input again.

Here is the code from the buttons:

Private Sub PrintReport_Click()
Dim strDocName As String

' Print report.

' On Error GoTo Err_Print_Click

' ValidateData

strDocName = "WeeklyPullsReport"
DoCmd.OpenReport strDocName, acViewNormal, , "[ShiftDate] BETWEEN #" & _
[Forms]![EmployeePullsDialogBox]![StartingDate] & "# AND #" & _
[Forms]![EmployeePullsDialogBox]![EndingDate] & "#"

Exit_Print_Click:
Exit Sub

Err_Print_Click:
' If Err = ConErrRptCanceled Then
' Resume Exit_Print_Click
' Else
' MsgBox Err.Description
' Resume Exit_Print_Click
'End If

End Sub


Private Sub btnPreview_Click()
On Error GoTo Err_btnPreview_Click

Dim stDocName As String

ValidateData

stDocName = "WeeklyPullsQuery"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Exit_btnPreview_Click:
Exit Sub

Err_btnPreview_Click:
MsgBox Err.Description
Resume Exit_btnPreview_Click

End Sub
Private Sub btnCancel_Click()
On Error GoTo Err_btnCancel_Click


DoCmd.Close

Exit_btnCancel_Click:
Exit Sub

Err_btnCancel_Click:
MsgBox Err.Description
Resume Exit_btnCancel_Click

End Sub

Thanks for any assistance you can offer, Ken.

Vince



"Ken Snell" wrote:

Walk me through your process for opening the "dialog" form and for running
the report. Which form is used to open the dialog form? to run the report?
and which code steps are you running and when and in which form/report?

--

Ken Snell
MS ACCESS MVP

"Vincent DeLuca" wrote in message
...
Yes, Ken-

The dialog box form never closes even after the report is closed. The

values remain in the text boxes the whole time.

Thanks.

Vincent DeLuca


"Ken Snell" wrote:

Are you keeping the form open while the report is being generated? You

need
to do that.

--

Ken Snell
MS ACCESS MVP

"Vincent DeLuca" wrote in

message
...
Ken-

Would the data that is passed from the query that is based upon a
parameter text box form be limited to the range specified by the

parameter
query as shown in a report based upon that query, or would you need to

"pass
along" the values to limit the data to the range desired within the

report
itself?

I have successfully created a parameter query based upon form text box
data for the desired date range that displays the accurate data, but

cannot
get a report based upon that query to print. The same report when

pulling
the same data in which I type in the parameters in popup boxes (based

upon a
copy of the same query without form references) works fine. I cannot

locate
the reason for this.

The query with the references to the dialog box form text boxes has

the
following parameters:

[Forms]![EmployeePullsDialogBox]![StartingDate] Date/Time
[Forms]![EmployeePullsDialogBox]![EndingDate] Date/Time

And in the [Date] column of this crosstab query:

Where

Between [Forms]![EmployeePullsDialogBox]![StartingDate] AND
[Forms]![EmployeePullsDialogBox]![EndingDate]

The same form without the dialog box references has the following
parameters:

StartingDate Date/Time
EndingDate Date/Time

Why would I be running into this problem?

Thanks.

Vincent DeLuca




"Ken Snell" wrote:

The Forms reference is interpreted by the report as meaning that

actual
form...not the parameter that you passed to the query. The query

notes
that
the form is not open and asks you for the value; the report notes

that
the
form is not open and tells you it cannot find the value you want

(the
error
in the textbox).

Note that a parameter passed to the query is not available to the

report
unless you also put that exact same parameter in the control source

of a
textbox on the report; then you can "pass" it along.

--

Ken Snell
MS ACCESS MVP

"sara" wrote in message
...
Interesting - that works! You just saved me what would
have been wasted debigging time.

BUT, I was having the problem testing the report on its
own - and the query's parameter was Forms!
F_PrintEEReports...., and I was typing in the date. Why
didn't that date carry through to the report? Does this
mean the users can't run the report from Reports or
Groups - only from the Form if they want the date to
appear?

Thanks so much. I can't tell you how wonderful I find
this community. I am the only person in this company who
does IT/applications, so there's no one to ask!
Sara


-----Original Message-----
Are you keeping the F_PrintEEReports form open while the
report is being
"printed"? If you close it beforehand, the report cannot
read the value from
the form's control.

--

Ken Snell
MS ACCESS MVP

"sara" wrote in
message
...
I have a Form to run reports. The field the user inputs
is often needed to display in the report's heading. For
example, the user enters "Week Ending Date" and I pull
all
the data for the week using Between WeekEndingdate and
DateAdd -6.

I want to display either BOTH dates, and sometimes just
the one date the user entered in the report heading, and
it always comes up #Name?. I can't find any reference
in
Help, either.

=([Forms]![F_PrintEEReports]![getWkMoDate])
(I've tried it with and without the parenthesis)

I can't figure this out!

Thanks,
Sara (newbie to code and forms)


.










  #10  
Old July 19th, 2004, 01:23 AM
Ken Snell
external usenet poster
 
Posts: n/a
Default Display Parameter from Form on Report-Interesting

OK - I think you may be expecting different behavior than ACCESS provides.

If you open a query that has parameters, the query will either find those
parameters or ask you for them. As you've noted, this is working for you in
your setup.

If you open a report that is based on a query (whether the report is opened
in preview or print mode), the query will be run by the report and again the
query will either get the parameters or ask you for them. If you open the
report in preview mode, and then click the report's print button, it won't
ask a second time for the parameters.

However, if you open a query and then open a report that is based on that
query, the report reruns the query. Hence, you'll get asked for parameters
twice if the query isn't able to obtain them. Thus, your desire to

When you click the button on your dialog form, do you then hide the dialog
form? Or does it stay open and the report / query is being opened while the
form is still onscreen? Perhaps you should have your code hide the dialog
form as part of the code that is run when the button is clicked. You then
can close the dialog form from the report's OnClose event or from some other
code that runs after the report is done.
--

Ken Snell
MS ACCESS MVP



"Vincent DeLuca" wrote in message
...
Ken-

The same Dialog Box is used to call both the query and the report. The

same two date input boxes are used for both as well. The user selects any
date from a calendar control and clicks a select week button. The code I
have written automatically enters the startingdate and the endingdate for
the week in the text boxes (or the user can manually enter the dates as
well). Then the user may select either a Preview button, a Print button or
a Close button. The preview button for now, calls the query and displays it
on the screen. Eventually, When the report works, I will do a
DoCmd.OpenReport acViewPreview instead of the query for the screen preview.
The Print button is supposed to print the report with the same parameters as
the Preview button and the query without asking the user for the input
again.

Here is the code from the buttons:

Private Sub PrintReport_Click()
Dim strDocName As String

' Print report.

' On Error GoTo Err_Print_Click

' ValidateData

strDocName = "WeeklyPullsReport"
DoCmd.OpenReport strDocName, acViewNormal, , "[ShiftDate] BETWEEN #" &

_
[Forms]![EmployeePullsDialogBox]![StartingDate] & "# AND #"

& _
[Forms]![EmployeePullsDialogBox]![EndingDate] & "#"

Exit_Print_Click:
Exit Sub

Err_Print_Click:
' If Err = ConErrRptCanceled Then
' Resume Exit_Print_Click
' Else
' MsgBox Err.Description
' Resume Exit_Print_Click
'End If

End Sub


Private Sub btnPreview_Click()
On Error GoTo Err_btnPreview_Click

Dim stDocName As String

ValidateData

stDocName = "WeeklyPullsQuery"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Exit_btnPreview_Click:
Exit Sub

Err_btnPreview_Click:
MsgBox Err.Description
Resume Exit_btnPreview_Click

End Sub
Private Sub btnCancel_Click()
On Error GoTo Err_btnCancel_Click


DoCmd.Close

Exit_btnCancel_Click:
Exit Sub

Err_btnCancel_Click:
MsgBox Err.Description
Resume Exit_btnCancel_Click

End Sub

Thanks for any assistance you can offer, Ken.

Vince



"Ken Snell" wrote:

Walk me through your process for opening the "dialog" form and for

running
the report. Which form is used to open the dialog form? to run the

report?
and which code steps are you running and when and in which form/report?

--

Ken Snell
MS ACCESS MVP

"Vincent DeLuca" wrote in

message
...
Yes, Ken-

The dialog box form never closes even after the report is closed. The

values remain in the text boxes the whole time.

Thanks.

Vincent DeLuca


"Ken Snell" wrote:

Are you keeping the form open while the report is being generated?

You
need
to do that.

--

Ken Snell
MS ACCESS MVP

"Vincent DeLuca" wrote in

message
...
Ken-

Would the data that is passed from the query that is based upon a
parameter text box form be limited to the range specified by the

parameter
query as shown in a report based upon that query, or would you need

to
"pass
along" the values to limit the data to the range desired within the

report
itself?

I have successfully created a parameter query based upon form text

box
data for the desired date range that displays the accurate data, but

cannot
get a report based upon that query to print. The same report when

pulling
the same data in which I type in the parameters in popup boxes

(based
upon a
copy of the same query without form references) works fine. I

cannot
locate
the reason for this.

The query with the references to the dialog box form text boxes

has
the
following parameters:

[Forms]![EmployeePullsDialogBox]![StartingDate] Date/Time
[Forms]![EmployeePullsDialogBox]![EndingDate] Date/Time

And in the [Date] column of this crosstab query:

Where

Between [Forms]![EmployeePullsDialogBox]![StartingDate] AND
[Forms]![EmployeePullsDialogBox]![EndingDate]

The same form without the dialog box references has the following
parameters:

StartingDate Date/Time
EndingDate Date/Time

Why would I be running into this problem?

Thanks.

Vincent DeLuca




"Ken Snell" wrote:

The Forms reference is interpreted by the report as meaning that

actual
form...not the parameter that you passed to the query. The query

notes
that
the form is not open and asks you for the value; the report

notes
that
the
form is not open and tells you it cannot find the value you want

(the
error
in the textbox).

Note that a parameter passed to the query is not available to

the
report
unless you also put that exact same parameter in the control

source
of a
textbox on the report; then you can "pass" it along.

--

Ken Snell
MS ACCESS MVP

"sara" wrote in message
...
Interesting - that works! You just saved me what would
have been wasted debigging time.

BUT, I was having the problem testing the report on its
own - and the query's parameter was Forms!
F_PrintEEReports...., and I was typing in the date. Why
didn't that date carry through to the report? Does this
mean the users can't run the report from Reports or
Groups - only from the Form if they want the date to
appear?

Thanks so much. I can't tell you how wonderful I find
this community. I am the only person in this company who
does IT/applications, so there's no one to ask!
Sara


-----Original Message-----
Are you keeping the F_PrintEEReports form open while the
report is being
"printed"? If you close it beforehand, the report cannot
read the value from
the form's control.

--

Ken Snell
MS ACCESS MVP

"sara" wrote in
message
...
I have a Form to run reports. The field the user inputs
is often needed to display in the report's heading. For
example, the user enters "Week Ending Date" and I pull
all
the data for the week using Between WeekEndingdate and
DateAdd -6.

I want to display either BOTH dates, and sometimes just
the one date the user entered in the report heading, and
it always comes up #Name?. I can't find any reference
in
Help, either.

=([Forms]![F_PrintEEReports]![getWkMoDate])
(I've tried it with and without the parenthesis)

I can't figure this out!

Thanks,
Sara (newbie to code and forms)


.












 




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

Similar Threads
Thread Thread Starter Forum Replies Last Post
6 Tables, 1 Report, W/O 6 Qrys Andy Setting Up & Running Reports 9 June 29th, 2004 09:52 PM
Creating a report from a form Kristin Setting Up & Running Reports 7 June 28th, 2004 09:21 PM
yet again form and report caleb General Discussion 2 June 26th, 2004 02:54 PM
Access 2003 report parameter problem Peter Kaufman Setting Up & Running Reports 0 June 10th, 2004 01:47 PM
Query Form: Print Report Dennis Running & Setting Up Queries 1 June 6th, 2004 01:08 PM


All times are GMT +1. The time now is 10:40 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.