I have tried the following corrections:
also,Private Sub btnOK_Click() 'OK button, escribo los valores en OPT DATA ValidClose = True Select Case ClType Case FUTURE, NOBID If Len(Me.FollowupDate.Text) = 0 Or Not IsDate(Me.FollowupDate.Text) Then ValidClose = False MsgBox "You must set a follow up date for this type of Close Action" End If End Select If ValidClose Then Application.ScreenUpdating = False rs!Status = ClType rs!Reason = Me.Reason.Text If Me.FollowupDate.Text <> "" Then rs!FollowupDate = CDate(Me.FollowupDate.Text) <-------- error Else rs!FollowupDate = Null End If Unload Me End If End Sub
and last,Private Sub btnOK_Click() If IsNumeric(Me.Followupdate.Value) Then ValidClose = True Select Case ClType Case FUTURE, NOBID If Len(Me.Followupdate.Text) = 0 Then ValidClose = False MsgBox "You must set a followup date for this type of Close Action" End If End Select If ValidClose Then Application.ScreenUpdating = False rs!Status = ClType rs!Reason = Me.Reason.Text If Me.Followupdate.Text <> "" Then rs!Followupdate = CDate(Me.Followupdate.Text) < -------Error Else rs!Followupdate = Null End If Unload Me End If Else MsgBox "Only numbers are allowed in the Followup Date Field." & vbLf & _ "Please try again" Me.Followupdate.SetFocus Me.Followupdate = "" End If End Sub
Private Sub btnOK_Click() If IsNumeric(Me.Followupdate.Value) Then ValidClose = True Select Case ClType Case FUTURE, NOBID If Len(Me.Followupdate.Text) > 0 Then ValidClose = False MsgBox "You must set a followup date for this type of Close Action" End If End Select If ValidClose Then Application.ScreenUpdating = False rs!Status = ClType rs!Reason = Me.Reason.Text If Me.Followupdate.Text <> "" Then rs!Followupdate = CDate(Me.Followupdate.Text) <------ Error Else rs!Followupdate = Null End If Unload Me End If Else MsgBox "Only numbers are allowed in the Followup Date Field." & vbLf & _ "Please try again" Me.Followupdate.SetFocus Me.Followupdate = "" End If End Sub
The test for length and IsDate should NOT be inside a Select Case statement.
Thanks I got it. I can be dense some time.
Private Sub btnOK_Click() 'OK button, escribo los valores en OPT DATA ValidClose = True Select Case ClType Case FUTURE, NOBID End Select If Len(Me.FollowupDate.Text) = 0 Or Not IsDate(Me.FollowupDate.Text) Then ValidClose = False MsgBox "You must set a follow up date for this type of Close Action" End If If ValidClose Then Application.ScreenUpdating = False rs!Status = ClType rs!Reason = Me.Reason.Text If Me.FollowupDate.Text <> "" Then rs!FollowupDate = CDate(Me.FollowupDate.Text) Else rs!FollowupDate = Null End If Unload Me End If End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks