I have a form using the ActiveX calendar, two text boxes (start date and end date) with a button. If I click button and its caption reads “set start date” then the date I have selected on the calendar goes in the start date box and the caption changed to “set end date” – the code I am using is below (very basic as I am not very experienced in this yet!)
Private Sub Button_Click()
If button.Caption = “Set Start Date” Then
TxtStartDate = calendar.Value
button.Caption = “Set End Date”
Else
txtEndDate = calendar.Value
button.Caption = “Set Start Date”
End If
End Sub
What I am seeking is a bit of code to stop me adding an end date which is earlier than the start date – giving me an appropriate message and making me try again (naturally leaving the button saying “Set End Date”.
Can anybody help please? I have tried putting validation rules in the properties of the text boxes themselves, but this has had no effect – so I guess it will have to be in the code?
Thanks
Roberta