Asking filter at time of running report

C

CAJ

Hi.. Not sure if this has been asked before - but I couldn't find anything on
it.

I have a report that has a date field in it. This date field can be blank.
I want to be able to ask at the time of running the report if I only want to
show the records that have this date field as blank.

I can set up a msg box ok - and if I use a "True/False" check box - what
code do I put it - assuming that "True" = only print blank date records for
that field, and "False" = all records.

Can anyone please help me.

Thanks so much
CAJ
 
K

Ken Snell \(MVP\)

Add a calculated field to your query that the report uses:

FilterDate: IIf(Len([NameOfYourDateField] & "") = 0, "Yes", "No")

Then add a Where expression for the field:
[Show just the blank dates (type Yes or No)]

Then the query will ask you to input Yes or No when it runs. No need for a
MsgBox nor for code.
 
C

CAJ

Ken,

Thanks so much for your help. I have done all that.. and when I run the
query or report I get the message
"You tried to execute a query that does not include the specified expression
(IIF... etc) as part of an aggregate function."

Thanks
CAJ

Ken Snell (MVP) said:
Add a calculated field to your query that the report uses:

FilterDate: IIf(Len([NameOfYourDateField] & "") = 0, "Yes", "No")

Then add a Where expression for the field:
[Show just the blank dates (type Yes or No)]

Then the query will ask you to input Yes or No when it runs. No need for a
MsgBox nor for code.

--

Ken Snell
<MS ACCESS MVP>



CAJ said:
Hi.. Not sure if this has been asked before - but I couldn't find anything
on
it.

I have a report that has a date field in it. This date field can be
blank.
I want to be able to ask at the time of running the report if I only want
to
show the records that have this date field as blank.

I can set up a msg box ok - and if I use a "True/False" check box - what
code do I put it - assuming that "True" = only print blank date records
for
that field, and "False" = all records.

Can anyone please help me.

Thanks so much
CAJ
 
C

CAJ

Don't worry - got it all to work...
Thanks so much for your help. Works beautifully and just the way I need it
to!

Ken Snell (MVP) said:
Add a calculated field to your query that the report uses:

FilterDate: IIf(Len([NameOfYourDateField] & "") = 0, "Yes", "No")

Then add a Where expression for the field:
[Show just the blank dates (type Yes or No)]

Then the query will ask you to input Yes or No when it runs. No need for a
MsgBox nor for code.

--

Ken Snell
<MS ACCESS MVP>



CAJ said:
Hi.. Not sure if this has been asked before - but I couldn't find anything
on
it.

I have a report that has a date field in it. This date field can be
blank.
I want to be able to ask at the time of running the report if I only want
to
show the records that have this date field as blank.

I can set up a msg box ok - and if I use a "True/False" check box - what
code do I put it - assuming that "True" = only print blank date records
for
that field, and "False" = all records.

Can anyone please help me.

Thanks so much
CAJ
 

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