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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculating Date Differences, need help on special code

Status
Not open for further replies.

ziggs

Technical User
Sep 21, 2000
195
US
Below you'll see the code I'm using in access to generate a number of days diffence based on certain criteria. However, I want to add one other stipulation. I have a checkbox field called Info. If that field called info is not checked, I won't to use the formula below. However, if the box called Info is checked, I do not want this formula to be run and I do not want a day total to populate. In other words, I want this field to be blank if info is checked.
-----------------Code-----------------------

Option Compare Database
Option Explicit

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If IsNull(Me.Cleared_Code) And IsNull(Me.Inactive_Code) Then
Me.DaysOpen = "(" & DateDiff("d", [Date_Assigned], Date) & ")"
DaysOpen.ForeColor = vbRed
DaysOpen.FontBold = True
Else
Me.DaysOpen = DateDiff("d", [Date_Assigned], [Date_Dispo])
DaysOpen.ForeColor = vbBlack
DaysOpen.FontBold = False

End If
End Sub [sig][/sig]
 
Put an If/Then statement in the event that calls the function to test the value of the check box.

If checked then run the sub. If the box is not checked it will drop through to the next line of code. [sig]<p>Larry De Laruelle<br><a href=mailto:larry1de@yahoo.com>larry1de@yahoo.com</a><br><a href= > </a><br> [/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top