extract the year part of date for report

pablavo

Registered User.
Local time
Today, 03:55
Joined
Jun 28, 2007
Messages
189
Hi there

I thought I knew this one but I'm having problems. I have a report which is opened by an imput form. for this I have entered the expression
Year([forms]![frmProjectYear]![txtProjectYear])
which, when opening the report will open the imput form above, I'll enter my year and it will take the year part of the date and only show records for that year! but this isn't what's happening.

Does anyone know what the expression would be for this? perhaps it's dateSerial?

thanks
 
Hi -

What specifically is included in [txtProjectYear]? Please provide an example.

Bob
 
Thanks for the reply Raskew.

The txtProjectYear is just an ordinary unbound text box. I've used the same method with another imput box which has two combo boxes with drop down months and two text boxes which the year will go in. This set up will create the from and to dates and I've used the following expression in the query that will bring up only the dates that are shown on the input box

Between DateSerial([Forms]![frmMonthCriteria]![txtYearfrom],[Forms]![frmMonthCriteria]![txtFrom],1) And DateSerial([Forms]![frmMonthCriteria]![txtYearTo],[Forms]![frmMonthCriteria]![txtTo],1-1)

However, in my next report I only want to use the year criteria so that the report will bring up only records that are within that year. So I tried to use

Year([forms]![frmProjectYear]![txtProjectYear])

which I believed that this expression would take the date from the text box "txtProjectYear" and use it as the criteria to extract records within that year.

I get a blank report with no records.

Is there something I might be doing wrong?

Thanks
 

Users who are viewing this thread

Back
Top Bottom