I have a textbox on a userform. When the userform loads the textbox has the current date in it. I also have spin buttons next to the textbox so users can change the date. When the user selects the submit button on my userform I have it set up to show a message box if the date in the textbox is greater than the current date. This has been working for the past year, except for today. Today is 01/01/19 (mm/dd/yy). I changed the date to yesterday (12/31/18), but my message box comes up and say that future dates are not permitted. I cannot figure out why the message box is showing because 12/31/18 is prior to (less than) 01/01/19.
Here is the code I am using so that future dates cannot be submitted.
Can someone please help?
Here is the code I am using so that future dates cannot be submitted.
Code:
If Me.TextBox5.Value > Format(Date, "MM/DD/YY") Then
MsgBox "A PROBLEM CANNOT BE FUTURE DATED"
Exit Sub
End If
Can someone please help?