Calculate Date

MichaelTran

New member
Local time
Today, 14:07
Joined
Sep 17, 2016
Messages
4
Hello All!

I have a Text Box(CompDate) in a form header that captured a date from a subform(CompDate).

I will have another text box(Last Check) to display a comparison today date and a CompDate.

The comparison will be:
If Today Date minus CompDate is less than 365 days, displays, "Last check is less than 1 year, "Last check is more more than 1 year".

Please help with in Code Builder.

Thank you in advance for your helps

Michael
 
remove any code that sets the value of CompDate.
we will be setting its value on the subform's Current Event:


Private Sub Form_Current()
Me.Parent!CompDate = Me.CompDate
If Trim(Me.CompDate & "") <> "" Then
If DateDiff("d", Me.CompDate, Date()) <365 Then
Me.Parent![Last Check] = "Last check is less than 1 year"
Else
Me.Parent![Last Check] = "Last check is more than 1 year"
End If
Else
Me.Parent![Last Check] = Null
End If
End Sub
 
Gasman,

Thank You,

Arnelgp,
I got an error message: The expression you entered has an invalided reference to the Parent property.

Thank you for your helps
 

Users who are viewing this thread

Back
Top Bottom