Condition too long? Alternatives??

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?
 
P

Piperlynne

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?
 
C

Clifford Bass

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top