Selection of records to Print

  • Thread starter Thread starter Brushcut1
  • Start date Start date
B

Brushcut1

I have a report generated that formats and prints all
records in a table (Name, address, & Phone Num. Etc.).
There is and additional field in the table labeled
[Y2004]. I would like to print only those records that
have a "Y" in this field.

How do I go about doing this? I assume it is a Query of
some type, but its not clear to me how to do it.
Dick
 
It would have been good if you told us what typical entries for Y2004 were,
so... I'm going to assume that the "Y" could be in any position of the
field.

In the RecordSource query for the report, in the Y2004 column place this
criteria...
Like "*" & "Y" & "*"

The 2 "*" are globals, and this criteria "reads" as "a field that has a 'Y'
in any position."
hth
Al Camp
 
The Y2004 field is a 1 character field, containing either
Y, N, or is blank. The name of the database is"PMHA
Directory Try 2". All fields are in that database.

In the Report design view, I click on View, Properties,
then data. The record Source has "PMHA Directory Try
2". The filter is empty, Filter off, Order by Empty, and
order by off.

I assume I need something like: =IIf([Y2004]="Y",(PMHA
Directory Try 2),"")

If I put the database name in "Record Source" and the
above IIf string in Filter and turn filter on, I get a
Syntax Error (Missing Operator) in Query Expression (
=IIf--- etc.

I'm new using Access so maybe the obvious isn't so
obvious. Am I close or still miles away.
Dick
-----Original Message-----
It would have been good if you told us what typical entries for Y2004 were,
so... I'm going to assume that the "Y" could be in any position of the
field.

In the RecordSource query for the report, in the Y2004 column place this
criteria...
Like "*" & "Y" & "*"

The 2 "*" are globals, and this criteria "reads" as "a field that has a 'Y'
in any position."
hth
Al Camp

I have a report generated that formats and prints all
records in a table (Name, address, & Phone Num. Etc.).
There is and additional field in the table labeled
[Y2004]. I would like to print only those records that
have a "Y" in this field.

How do I go about doing this? I assume it is a Query of
some type, but its not clear to me how to do it.
Dick


.
 
In Report Design view, do just as you have, selecting the table in the
Record Source line of the Properties box, but in the Filter line, simply
enter this text:

Y2004 = "Y"

That should do it.

If you need to change this filter frequently, you will want to do it in VBA,
most likely in the code behind a command button on a form. The syntax for
this would be

DoCmd.OpenReport "MyReportName", acViewPreview, , "Y2004 = 'Y'"

Note the single quotes around the letter Y. The last parameter is the WHERE
condition, as it would appear in a query but without the WHERE keyword. Be
sure to leave the preceding parameter blank for this usage. Your code can
be flexible, too, using a text control on a form, for example, or the value
from a combobox, e.g.,

DoCmd.OpenReport "MyReportName", acViewPreview, , "Y2004 = '" &
cboMyComboBox & "'"

where the value of cboMyComboBox is "Y" or "N" or blank, as you say. Again
note the single quotes.

HTH

Paul Johnson

The Y2004 field is a 1 character field, containing either
Y, N, or is blank. The name of the database is"PMHA
Directory Try 2". All fields are in that database.

In the Report design view, I click on View, Properties,
then data. The record Source has "PMHA Directory Try
2". The filter is empty, Filter off, Order by Empty, and
order by off.

I assume I need something like: =IIf([Y2004]="Y",(PMHA
Directory Try 2),"")

If I put the database name in "Record Source" and the
above IIf string in Filter and turn filter on, I get a
Syntax Error (Missing Operator) in Query Expression (
=IIf--- etc.

I'm new using Access so maybe the obvious isn't so
obvious. Am I close or still miles away.
Dick
-----Original Message-----
It would have been good if you told us what typical entries for Y2004 were,
so... I'm going to assume that the "Y" could be in any position of the
field.

In the RecordSource query for the report, in the Y2004 column place this
criteria...
Like "*" & "Y" & "*"

The 2 "*" are globals, and this criteria "reads" as "a field that has a 'Y'
in any position."
hth
Al Camp

I have a report generated that formats and prints all
records in a table (Name, address, & Phone Num. Etc.).
There is and additional field in the table labeled
[Y2004]. I would like to print only those records that
have a "Y" in this field.

How do I go about doing this? I assume it is a Query of
some type, but its not clear to me how to do it.
Dick


.
 
The record Source has "PMHA Directory Try 2"
What is "PMHA Directory Try 2"?? A table or a query?

If it's a table that contains the field Y2004 then...
Create a Query using the query design grid and call it qryMyReportCriteria.
Base that query on the table "PMHA Directory Try 2" and in the Y2004 column
of the query put this criteria...
= "Y"
In the recordSource for your report put "qryMyReportCriteria"
This will force the report to only display records with a Y2004 value of "Y"
hth
Al Camp

The Y2004 field is a 1 character field, containing either
Y, N, or is blank. The name of the database is"PMHA
Directory Try 2". All fields are in that database.

In the Report design view, I click on View, Properties,
then data. The record Source has "PMHA Directory Try
2". The filter is empty, Filter off, Order by Empty, and
order by off.

I assume I need something like: =IIf([Y2004]="Y",(PMHA
Directory Try 2),"")

If I put the database name in "Record Source" and the
above IIf string in Filter and turn filter on, I get a
Syntax Error (Missing Operator) in Query Expression (
=IIf--- etc.

I'm new using Access so maybe the obvious isn't so
obvious. Am I close or still miles away.
Dick
-----Original Message-----
It would have been good if you told us what typical entries for Y2004 were,
so... I'm going to assume that the "Y" could be in any position of the
field.

In the RecordSource query for the report, in the Y2004 column place this
criteria...
Like "*" & "Y" & "*"

The 2 "*" are globals, and this criteria "reads" as "a field that has a 'Y'
in any position."
hth
Al Camp

I have a report generated that formats and prints all
records in a table (Name, address, & Phone Num. Etc.).
There is and additional field in the table labeled
[Y2004]. I would like to print only those records that
have a "Y" in this field.

How do I go about doing this? I assume it is a Query of
some type, but its not clear to me how to do it.
Dick


.
 
Back
Top