I'm using a DBCombo box populated with data from an Access2003 table. When I select a record in the combo box I want to check a second table, if a matching record is not there add it.
Does the DBCombo support an AfterUpdate event? The following code doesn't even fire when I chose a record in the combo box.
Private Sub DBcboCompany_AfterUpdate()
Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset
conn.Open strConn
rs.Open "Select NameofCompany,RefID From tblToDo Order By NameofCompany;", conn, dbOpenTable, dbForwardOnly
If rs.BOF And rs.EOF Then
conn.Execute "insert into tblToDo(NameofCompany) values("" & DBcboCompany.Text & "")"
End If
rs.Close
Set rs = Nothing
conn.Close
Set conn = Nothing
End Sub
Thanks
Does the DBCombo support an AfterUpdate event? The following code doesn't even fire when I chose a record in the combo box.
Private Sub DBcboCompany_AfterUpdate()
Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset
conn.Open strConn
rs.Open "Select NameofCompany,RefID From tblToDo Order By NameofCompany;", conn, dbOpenTable, dbForwardOnly
If rs.BOF And rs.EOF Then
conn.Execute "insert into tblToDo(NameofCompany) values("" & DBcboCompany.Text & "")"
End If
rs.Close
Set rs = Nothing
conn.Close
Set conn = Nothing
End Sub
Thanks