I have a UserForm that creates a new record - which calls another UserFDorm (CalendarForm - Developed by Trevor Eyre) as follows ...
Note: CalendarForm returns the date in US format - hence the Format command to turn it into UK format ...
Which is followed by ...
Note: both work as intended/expected ...
And then when the Save button is clicked ...
But unless both dates are in the same month (at least I think that's the trigger), the validation fails ...
I can't see why - any ideas???
Thanks ...
VBA Code:
Function GetFormattedDate() As String
Dim dateVariable As Date
dateVariable = CalendarForm.GetDate
If dateVariable <> 0 Then
GetFormattedDate = Format$(dateVariable, "dd/mm/yyyy")
End If
End Function
Note: CalendarForm returns the date in US format - hence the Format command to turn it into UK format ...
Which is followed by ...
VBA Code:
Private Sub cmdReportedDate_Click()
Me.txtReportedDate.Text = GetFormattedDate()
End Sub
Private Sub cmdIncidentDate_Click()
Me.txtIncidentDate.Text = GetFormattedDate()
End Sub
Note: both work as intended/expected ...
And then when the Save button is clicked ...
VBA Code:
If txtReportedDate < txtIncidentDate Then
MsgBox "The Reported Date must be on or after the Incident Date, please correct and Save again"
Exit Sub
End If
But unless both dates are in the same month (at least I think that's the trigger), the validation fails ...
I can't see why - any ideas???
Thanks ...