Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dislpay DateDiff reluts in a report

Status
Not open for further replies.

zjzastava

Technical User
Feb 25, 2011
20
US
I am trying to display the result of DateDiff function in a report and am having trouble getting it to work.

I am using a text box and in the control source i used
=DateDiff("ww",[forms].[frmDateRangeAvgOA].[txtDateStartAvgOA],[forms].[frmDateRangeAvgOA].[txtDateEndAvgOA])

For the example I used 7/1/2010 - 7/31/2010 and the text box displayed 1900 when it should have displayed 4. Any help to get this to work would be helpful.

Thank You
Zac Z
 
This should work. What do you see if you add a text box on frmDateRangeAvgOA with a control source of:
Code:
=DateDiff("ww",[txtDateStartAvgOA],[txtDateEndAvgOA])
If this works, you could change the control source in the report to:
Code:
  =[forms].[frmDateRangeAvgOA].[txtNameOfDateDiffControl]

Duane
Hook'D on Access
MS Access MVP
 
The correct number (4) is being shown in the text box on the form. I am still getting 1900 displayed in the text box on the report.
 
In addition, I use a different date range and in the text box on the form the correct number appeared but on the report it displayed 1900
 
I have this working. It was a simple error on my part. The format for the text box on the report was wrong.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top