I'm trying to insert a value and delete a value in a record based off a check box click event using an ADODB connection. The insert works but when it reaches the ELSEIF statement where i want to delete the entry if the user clicks on the checkbox but realizes they dont want that selected. I'm getting the error above in the title.
Issue code bolded below
Private Sub Check_AMI_Click()
Dim conn As ADODB.Connection
Dim strSQL As String
Dim insertValue As String
Set conn = CurrentProject.Connection
If Me.Check_AMI.Value = -1 Then
strSQL = "INSERT INTO Events ( Hospitalization_for ) VALUES( 'AMI-STEMI' )"
conn.Execute strSQL
conn.Close
Set conn = Nothing
Me.Dirty = False
Me.Check_AMI.DefaultValue = "0"
Me.Requery
ElseIf Me.Check_AMI.Value = 0 Then
'strSQL = "UPDATE Events ( Hospitalization_for = "")"
strSQL = "UPDATE [Events] SET [Hospitalization_for] = Null WHERE [Me.EventID] = " & Me.EventID & ""
conn.Execute strSQL
conn.Close
Set conn = Nothing
Me.Dirty = False
Me.Check_AMI.DefaultValue = "-1"
Me.Requery
End If
End Sub
Any help is apprecaited, thanks.