Parameter in a report

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a report with a subreport. In each on the queries
I'm asking for the same information [Enter the Year]. When
the report is retrieved it asks for the year three times.
Is there anyway just to ask for the year once?

Thanks in advance

Penny
 
Create a small unbound form named (say) "frmReportCriteria", with a text box
that has these properties:
Name txtWotYear
Format General Number
Default Value =Year(Date())
Validation Rule Between 2000 And 2200
Validation Text Enter a 4-digit year

In the Criteria row of your query, under the date field, enter:
Between DateSerial([Forms]![frmReportCriteria]![txtWotYear], 1,1) And
DateSerial([Forms]![frmReportCriteria]![txtWotYear], 12, 31)

Do the same in the query for the subreport.
 
I don't thing I'm doing this correct. When I do this the
parameter says Forms!frmReportCriteria!txtWotYear then I
type in a year and it's blank query. Field Name is Year
and just the year is the data.
-----Original Message-----
Create a small unbound form named
(say) "frmReportCriteria", with a text box
that has these properties:
Name txtWotYear
Format General Number
Default Value =Year(Date())
Validation Rule Between 2000 And 2200
Validation Text Enter a 4-digit year

In the Criteria row of your query, under the date field, enter:
Between DateSerial([Forms]![frmReportCriteria]! [txtWotYear], 1,1) And
DateSerial([Forms]![frmReportCriteria]![txtWotYear], 12, 31)

Do the same in the query for the subreport.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

I have a report with a subreport. In each on the queries
I'm asking for the same information [Enter the Year]. When
the report is retrieved it asks for the year three times.
Is there anyway just to ask for the year once?

Thanks in advance

Penny


.
 
If you open the table in design view, what data type is your Year field?
Text? Number? Date/Time?

If Text, then remove the "General Number" from the format of the text box so
Access treats it as text, not number.

The Criteria can be just:
[Forms]![frmReportCriteria]![txtWotYear]

If that still plays up, try renaming the field. There is a Year() function
in VBA, so it is possible that the field name is confusing Access.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

I don't thing I'm doing this correct. When I do this the
parameter says Forms!frmReportCriteria!txtWotYear then I
type in a year and it's blank query. Field Name is Year
and just the year is the data.
-----Original Message-----
Create a small unbound form named
(say) "frmReportCriteria", with a text box
that has these properties:
Name txtWotYear
Format General Number
Default Value =Year(Date())
Validation Rule Between 2000 And 2200
Validation Text Enter a 4-digit year

In the Criteria row of your query, under the date field, enter:
Between DateSerial([Forms]![frmReportCriteria]! [txtWotYear], 1,1) And
DateSerial([Forms]![frmReportCriteria]![txtWotYear], 12, 31)

Do the same in the query for the subreport.

I have a report with a subreport. In each on the queries
I'm asking for the same information [Enter the Year]. When
the report is retrieved it asks for the year three times.
Is there anyway just to ask for the year once?

Thanks in advance

Penny
 
Back
Top