Referencing criteria form field values from reports

G

Guest

Hi all,
I have a criteria form that takes a date range for a report.
What I want to do is that if the date range fields have not been entered
then I want some customised message (eg. No Date) on the report...
I have a txtbox on the report hearder and and here is how I am trying to
reference the date range fields...

="Between " &
IIf([Forms]![frmSalesCrit]![bDate].[HasData],[Forms]![frmSalesCrit]![bDate],"No
Date") & " And " &
IIf([Forms]![frmSalesCrit]![eDate].[HasData],[Forms]![frmSalesCrit]![eDate],"No Date")


But I can't seem to get it working, can someone help me out?
Thanks alot.
 
G

Guest

I changed it to the lines like shown below but I get #Name error. What am I
doing wrong?

="Between " & IIf(IsNull([Forms]![frmSalesCrit]![bDate]) Or
([Forms]![frmSalesCrit]![bDate]=""),[Forms]![frmSalesCrit]![bDate],"No Date")
&
" And " & IIf(IsNull([Forms]![frmSalesCrit]![eDate]) Or
([Forms]![frmSalesCrit]![eDate]=""),[Forms]![frmSalesCrit]![eDate],"No Date")
 
D

Duane Hookom

Try
="Between " & Nz([Forms]![frmSalesCrit]![bDate],"No Date") & " And " &
Nz([Forms]![frmSalesCrit]![eDate], "No Date")
 
G

Guest

Duane,
I did a copy and paste on your answer and I'm away grinning :)
Thanks
--
niuginikiwi
Nelson, New Zealand


Duane Hookom said:
Try
="Between " & Nz([Forms]![frmSalesCrit]![bDate],"No Date") & " And " &
Nz([Forms]![frmSalesCrit]![eDate], "No Date")

--
Duane Hookom
MS Access MVP


niuginikiwi said:
Hi all,
I have a criteria form that takes a date range for a report.
What I want to do is that if the date range fields have not been entered
then I want some customised message (eg. No Date) on the report...
I have a txtbox on the report hearder and and here is how I am trying to
reference the date range fields...

="Between " &
IIf([Forms]![frmSalesCrit]![bDate].[HasData],[Forms]![frmSalesCrit]![bDate],"No
Date") & " And " &
IIf([Forms]![frmSalesCrit]![eDate].[HasData],[Forms]![frmSalesCrit]![eDate],"No
Date")


But I can't seem to get it working, can someone help me out?
Thanks alot.
 

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