Form Date Field Less than Form Date Field 2 + 30 days

Lochwood

Registered User.
Local time
Today, 07:19
Joined
Jun 7, 2017
Messages
130
I have 2 date fields in a subform and code that if [Date_Field1] < [Date_Field2] it displays a hidden button . this works but i would only like the button to show if [Date_Field1] < [date_Field2] +30 days. Cant get the code to work by adding +30. where am i going wrong?

Thanks.
 
Hi. Can you show us your code please?
 
If [Last_date] < ([Due_Date_Field] +30) Then
Me.Update_DD_Button.Visible = True

End If
Thanks. What happens if you change that to this?
Code:
 If [Last_date] < DateAdd("d",30,[Due_Date_Field]) Then
    Me.Update_DD_Button.Visible = True
End If
 
Thanks. What happens if you change that to this?
Code:
 If [Last_date] < DateAdd("d",30,[Due_Date_Field]) Then
    Me.Update_DD_Button.Visible = True
End If

Still the same. regardless of what date i put in.. it shows the button.
 
Still the same. regardless of what date i put in.. it shows the button.
Okay, I have a feeling we're not talking about actual dates here. Can you post some sample data or screenshots? Where are those dates coming from?
 
Okay, I have a feeling we're not talking about actual dates here. Can you post some sample data or screenshots? Where are those dates coming from?


Cant really send you that. the date fields are Medium Date format and are actual fields in the table. if i take out the + 30 it works
 
Cant really send you that. the date fields are Medium Date format and are actual fields in the table. if i take out the + 30 it works
No screenshots either? Hmm, can you type those dates in your post? For example, does this work?

Code:
If "9/22/2020" < "9/23/2020" Then
    Me.Update_DD_Button.Visible = True
End If
 
You need an ELSE statement that makes it visible=false

if condition then
button=true
else
button=false
end if
 

Users who are viewing this thread

Back
Top Bottom