Limit records on report based on field length

P

Patty Stoddard

How do I limit the report to only those the records that have a certain
number of characters in a text field.

I have a text field that has anywhere from two to five characters. I only
want the report to show those that have five characters.

I think I need to create a calculated field on the report using the script
LEN = 5, but don't know how to do this.
 
R

Rick Brandt

Patty Stoddard said:
How do I limit the report to only those the records that have a certain
number of characters in a text field.

I have a text field that has anywhere from two to five characters. I only
want the report to show those that have five characters.

I think I need to create a calculated field on the report using the script
LEN = 5, but don't know how to do this.

Use the expression...

=Len(TextFieldName)

If you added that as a calculated field in the query the report was bound to
then you could include the criteria =5 on that same field.
 
P

Patty Stoddard

I stated my question wrong. The query does not have a calculated field. I
think I want to use a "control" on my report. In the design view of the
report, what do I do? For example, should I click on the field I want to do
the control on. If so, what then?

Thanks Rick.
 
R

Rick Brandt

Patty Stoddard said:
I stated my question wrong. The query does not have a calculated field. I
think I want to use a "control" on my report. In the design view of the
report, what do I do? For example, should I click on the field I want to do
the control on. If so, what then?

Having a calculated control on the report is not necessary.

You need to either ADD a calculated field to the query or else apply a filter
when opening the report by using the WHERE argument of the OpenReport method.

DoCmd.OpenReport "ReportName", acViewPreview,,"Len(FieldName)=5"
 
Top