C
Chad
Hello, I have a form with two text boxes on it "txtStartDate" and
"txtEndDate" and I want to use a Private Function ValidDates() As Boolean for
my validation. What am I doing wrong? Its using the (MsgOK) to bring up the
office assistant which works. the thing is I cant get the form to open if I
have valid dates in the txt boxes ect. Thank! Below is what I want and below
that is what I have working but as I said I want to use the (MsgOK) to bring
up the office assistant. Please help... Thanks!
'*********************************************
'* Function to validate a Start and End date *
'*********************************************
Private Function ValidDates() As Boolean
If IsDate(Me.txtStartDate) And IsDate(Me.txtEndDate) = False Then
MsgOK "Both Start and End Dates are Required for the Reports.",
"Required"
ValidDates = False
Exit Function
End If
If Me.txtStartDate > Me.txtEndDate Then
MsgOK "Start Date must be EQUAL TO or LESS THAN End Date."
ValidDates = False
Exit Function
End If
End Function
'*********************************************
'* Function to validate a Start and End date *
'*********************************************
Private Function ValidDates() As Boolean
Dim strMsg As String
ValidDates = True
If IsDate(Me.txtStartDate) And IsDate(Me.txtEndDate) Then
If Me.txtStartDate > Me.txtEndDate Then
strMsg = "Start Date must be EQUAL TO or LESS THAN End Date."
End If
Else
strMsg = "Both Start and End Dates are Required for the Reports."
End If
If Len(strMsg) Then
MsgBox strMsg, vbOKOnly, "Date Entry Error"
ValidDates = False
End If
End Function
"txtEndDate" and I want to use a Private Function ValidDates() As Boolean for
my validation. What am I doing wrong? Its using the (MsgOK) to bring up the
office assistant which works. the thing is I cant get the form to open if I
have valid dates in the txt boxes ect. Thank! Below is what I want and below
that is what I have working but as I said I want to use the (MsgOK) to bring
up the office assistant. Please help... Thanks!
'*********************************************
'* Function to validate a Start and End date *
'*********************************************
Private Function ValidDates() As Boolean
If IsDate(Me.txtStartDate) And IsDate(Me.txtEndDate) = False Then
MsgOK "Both Start and End Dates are Required for the Reports.",
"Required"
ValidDates = False
Exit Function
End If
If Me.txtStartDate > Me.txtEndDate Then
MsgOK "Start Date must be EQUAL TO or LESS THAN End Date."
ValidDates = False
Exit Function
End If
End Function
'*********************************************
'* Function to validate a Start and End date *
'*********************************************
Private Function ValidDates() As Boolean
Dim strMsg As String
ValidDates = True
If IsDate(Me.txtStartDate) And IsDate(Me.txtEndDate) Then
If Me.txtStartDate > Me.txtEndDate Then
strMsg = "Start Date must be EQUAL TO or LESS THAN End Date."
End If
Else
strMsg = "Both Start and End Dates are Required for the Reports."
End If
If Len(strMsg) Then
MsgBox strMsg, vbOKOnly, "Date Entry Error"
ValidDates = False
End If
End Function