Condition too long? Alternatives??

  • Thread starter Thread starter Piperlynne
  • Start date Start date
P

Piperlynne

I am trying to place a condition in a macro that runs reports based on data
input into a form. There are 6 criteria on the form. I am attempting to write
an IsNull statement so that if the user inputs no data, the report filters by
"ALL" aka no seletion criteria - all records returned. It keeps truncating my
statement.

IsNull([Forms]![frmReports]![ProfCdSrch]) And
IsNull([Forms]![frmReports]![CustSrch]) And
IsNull([Forms]![frmReports]![BrandSrch]) And
IsNull([Forms]![frmReports]![SKUSrch]) And
IsNull([Forms]![frmReports]![ProductSrch]) And
IsNull([Forms]![frmReports]![StatusSrch])

this would open the qryReportALL make table query, I would also be writing
statements for each variation of these 6 fields being populated in the form.
Then outputting the report data based on the table that is created.

Since this seems too long. .anyone have a work around or solution to get
this to work?
 
Ok, I shortened the form and field names and it fits now. . .now I'm getting
syntax error. I can't win. What am I doing wrong?
 
Hi,

It may be time to make the shift to VBA, where you will not have that
trouble and where you have much more flexability. It would be worth it in
the long run. But in the short term, you could create an invisible check box
on your form that has this for its control source:

=IsNull([ProfCdSrch]) And IsNull([CustSrch]) And IsNull([BrandSrch]) And
IsNull([SKUSrch]) And IsNull([ProductSrch]) And IsNull([StatusSrch])

Then your condition would become simply [Forms]![frmReports]![chkAllNull].

Clifford Bass

Piperlynne said:
Ok, I shortened the form and field names and it fits now. . .now I'm getting
syntax error. I can't win. What am I doing wrong?

Piperlynne said:
I am trying to place a condition in a macro that runs reports based on data
input into a form. There are 6 criteria on the form. I am attempting to write
an IsNull statement so that if the user inputs no data, the report filters by
"ALL" aka no seletion criteria - all records returned. It keeps truncating my
statement.

IsNull([Forms]![frmReports]![ProfCdSrch]) And
IsNull([Forms]![frmReports]![CustSrch]) And
IsNull([Forms]![frmReports]![BrandSrch]) And
IsNull([Forms]![frmReports]![SKUSrch]) And
IsNull([Forms]![frmReports]![ProductSrch]) And
IsNull([Forms]![frmReports]![StatusSrch])

this would open the qryReportALL make table query, I would also be writing
statements for each variation of these 6 fields being populated in the form.
Then outputting the report data based on the table that is created.

Since this seems too long. .anyone have a work around or solution to get
this to work?
 
Back
Top