Display Parameter from Form on Report

  • Thread starter Thread starter sara
  • Start date Start date
S

sara

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)
 
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.
 
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>

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)


.
 
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 said:
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>

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)


.
 
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
(e-mail address removed)



Ken Snell said:
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 said:
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>

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)


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

--

Ken Snell
<MS ACCESS MVP>

Vincent DeLuca said:
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
(e-mail address removed)



Ken Snell said:
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 said:
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>

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)


.
 
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
(e-mail address removed)

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

--

Ken Snell
<MS ACCESS MVP>

Vincent DeLuca said:
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
(e-mail address removed)



Ken Snell said:
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>

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>

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)


.
 
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 said:
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
(e-mail address removed)

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

--

Ken Snell
<MS ACCESS MVP>

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
(e-mail address removed)



:

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>

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>

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)


.
 
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 said:
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 said:
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
(e-mail address removed)

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

--

Ken Snell
<MS ACCESS MVP>

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
(e-mail address removed)



:

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>

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>

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)


.
 
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 said:
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 said:
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>

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
(e-mail address removed)

:

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

--

Ken Snell
<MS ACCESS MVP>

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
(e-mail address removed)



:

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>

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>

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)


.
 
This may be the same issue as Vince has going in two other threads. Forgive
me if I am wrong. However, I think the query behind the report does not pass
the ShiftDate field to the report fields. When viewing field list in the
design view of the report, does the field ShiftDate display? If not, you
can't use it in the where clause of DoCmd.OpenReport.

--
Duane Hookom
MS Access MVP
--


Ken Snell said:
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>



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 said:
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>

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
(e-mail address removed)

:

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

--

Ken Snell
<MS ACCESS MVP>

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
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
(e-mail address removed)



:

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>

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>

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)


.
 
Back
Top