Formula In Page Header not Working

G

Guest

Hi,

I am using a formula in the Page Header of my report that is working
properly on the first page and not the second. The page header consists of a
Title & my date formula. The title properly appears on all pages. However,
the dates are only working on the first page. On the second page the date
formula prints "#Error".

The date formula I am using evaluates whether or not dates were entered on
an input form, if not, it prints the date range of the current month. THe
formula I am using in the page header is:

="Report Date: " & IIf(IsNull([Forms]![frmWhatDates]![txtStartDate]) And
IsNull([Forms]![frmWhatDates]![txtEndDate]),(DateSerial(Year(Date()),Month(Date()),1))
& " And " & Date(),[Forms]![frmWhatDates]![txtStartDate] & " - " &
[Forms]![frmWhatDates]![txtEndDate])


Any Ideas on where I am going wrong????

Thanks!
 
G

Guest

How about something like:
= "Report Date: " &
IIf(IsNull([Forms]![frmWhatDates]![txtStartDate]),DateSerial(Year(Date()),Month(Date()),1),[Forms]![frmWhatDates]![txtStartDate]
& " to " &
IIf(IsNull([Forms]![frmWhatDates]![txtEndDate]),DateSerial(Year(Date()),Month(Date())+1,0),[Forms]![frmWhatDates]![txtEndDate])
I haven't tested the code, but what it should do is to see if [txtStartDate]
is null. If it is, the first day of the current month will appear.
Similarly, the last day of the current month will appear if [txtEndDate] is
null.
Your IIf expression seems to have some syntax problems, which would account
for the error message. I'm not sure why it worked on the first page.
 

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