I am trying to have a form update certain fields based on the user changing a field value. Below is the code that I have written.
Private Sub CBOCOMPLETE_AfterUpdate()
If IsNull(CLASSDATE) Then
CLASSDATE = InputBox("You must enter the date this class was completed.")
End If
If CLASSCOMPLETED = "YES" Then
Me.CLASSHOURS = Me.COURSEHOURS
ElseIf CLASSCOMPLETED <> "YES" Then
Me.CLASSHOURS = 0
End If
Dim strdate As String
strdate = DateAdd("M", Me.FREQUENCY, Me.CLASSDATE)
If Me.COURSECATEGORY = "PRIMARY CERTIFICATION" And Me.CLASSCOMPLETED = "YES" Then
Me.EXPIRATIONDATE = strdate
ElseIf COURSECATEGORY = "SECONDARY CERTIFICATION" And Me.CLASSCOMPLETED = "YES" Then
Me.EXPIRATIONDATE = strdate
ElseIf Me.COURSECATEGORY <> "PRIMARY CERTIFICATION" Or "SECONDARY CERTIFICATION" And CLASSCOMPLETED = "YES" Then
Me.CLASSHOURS = Me.COURSEHOURS And Nz(EXPIRATIONDATE)
End If
On Error Resume Next
End Sub
This works fine if the class has an expiration date. Unfortunately, many of my classes do not have or require an expiration date and that's when I get the error message. Ideas on how to correct?