Looking for a better way to do this

q582gmzhi

Registered User.
Local time
Today, 09:51
Joined
Dec 23, 2002
Messages
48
Hi,

I use the following code in the "On Format" within the detail section of a report. I have to copy and paste the code when the field name changes. So I have multiple copies which display differences for the Passdate and Case Select sections. Is it possible to use the following code once but pass the field details for the Passdate and Select Case part?

Thanks in advance.

Daz....
=====================================
Dim Workdate, Passdate, CalcDate
Workdate = Date
Passdate = Me.Abr75KTLG 'Change This to The Specific Field
CalcDate = DateDiff("d", Passdate, Workdate)

If CalcDate = Null Then
CalcDate = 0
Else
End If

Select Case CalcDate
Case Is < 334
Me.Abr75KTLG.ForeColor = vbGreen
Case 334 To 365
Me.Abr75KTLG.ForeColor = 33023
Case Is > 365
Me.Abr75KTLG.ForeColor = vbRed
Case Else
Me.Abr75KTLG.ForeColor = vbBlack
End Select
==================================
 

Users who are viewing this thread

Back
Top Bottom