I'm using the following code behind a combo box name cboCompy. For some reason when I make a selection from the pulldown in the combo box this code won't fire. No errors appear but the code won't execute. I put stop in the code so I can view but it never does.
I also tried _Change instead of _OnChange. I'm new to VB6 so pardon a dumb question.
Is there something in the properties need to change?
Thanks,
Private Sub cboCompy_OnChange()
Dim name As String, str As String
Set rs = Nothing
If Me.cboComp <> "Combo1" Then
name = Me.cboComp
str = "select * from tblToDo where NameofComp = '" & name & "'"
' str = "select * from tblToDo where NameofComp = " & name
rs.Open str, adoconn, adOpenForwardOnly, adLockPessimistic
If rs.EOF Then
rs.AddNew
rs(0) = name
rs.Update
Else
FillFields
End If
End If
Set rs = Nothing
str = "select * from tblToDo"
rs.Open str, adoconn, adOpenDynamic, adLockPessimistic
End Sub