I'm adding a record to a db and setting a combo boxs text to the newly added record. I haven't run into this problem before, but each time I exit the sub, the combo box text dissappears.
VB Code:
Private Sub cmbPrimaryAffiliation_Click() Dim currentSecondary As String currentSecondary = cmbSecondary.text If cmbPrimaryAffiliation.text <> "" Then If cmbPrimaryAffiliation.text = "Add A Company" Then leadsAdding = True frmAddCompany.Show vbModal If rs.State = adStateOpen Then rs.Close rs.Open "SELECT * FROM tblcompany ORDER BY company", cn, adOpenKeyset, adLockReadOnly, adCmdText cmbPrimaryAffiliation.Clear cmbSecondary.Clear Do Until rs.EOF = True cmbPrimaryAffiliation.AddItem rs!company cmbSecondary.AddItem rs!company rs.MoveNext Loop cmbPrimaryAffiliation.AddItem "Add A Company" cmbSecondary.AddItem "Add A Company" cmbPrimaryAffiliation.text = frmAddCompany.compName cmbSecondary.text = currentSecondary leadsAdding = False End If End If End Sub
The text is visible after the .Text line, but when I get to End Sub - it dissappears. Any ideas?
Thanks




Reply With Quote