Need help with formula

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello I have a text box that has a date in it. I want to add a text box next
to it and have it appear when its past the date and count the days that has
gone past. I put this code in the text box's control source next to the one
that shows the date but it shows a negative number if before the date shown
but works if it has gone past the date. What do I need to add to the code to
make this work?

=Format(DateDiff("d",[txtPeriodEndDate],Date()),0) & " Days Past Due"
 
Chad

So you're saying that you want the second textbox to not be visible until
after it holds a value >0? Take a look at Conditional Formatting and see if
you can use that?

Or you may need to add an Event Procedure to the textbox's .Visible property
to do the same. I can imagine something like (untested aircode follows):

Me!SecondTextBox.Visible = (Me!SecondTextBox > 0)

--
Regards

Jeff Boyce
www.InformationFutures.net

Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/
 
Sorry I double posted because I couldnt find my first post. Douglass steel
answered my question with this answer and it works great! I greatly
appreciate you help though...

Post: Count days overdue formula help
Answer:
=IIf(DateDiff("d",[txtPeriodEndDate],Date()) > 0,
Format(DateDiff("d",[txtPeriodEndDate],Date()),"0") & " Days Past Due",
Null)

--
Newbies need extra loven.........


Jeff Boyce said:
Chad

So you're saying that you want the second textbox to not be visible until
after it holds a value >0? Take a look at Conditional Formatting and see if
you can use that?

Or you may need to add an Event Procedure to the textbox's .Visible property
to do the same. I can imagine something like (untested aircode follows):

Me!SecondTextBox.Visible = (Me!SecondTextBox > 0)

--
Regards

Jeff Boyce
www.InformationFutures.net

Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/

Chad said:
Hello I have a text box that has a date in it. I want to add a text box next
to it and have it appear when its past the date and count the days that has
gone past. I put this code in the text box's control source next to the one
that shows the date but it shows a negative number if before the date shown
but works if it has gone past the date. What do I need to add to the code to
make this work?

=Format(DateDiff("d",[txtPeriodEndDate],Date()),0) & " Days Past Due"
 
Back
Top