I am having a small problem locating any information on this little problem on the net so I am coming here for help AGAIN.
I have a VB6 project that has a combobox. This is needing to display data from my SQL db. I have it displaying the data fine. But if I have a value already set in the db for this record i want it to display that item.
Unfortunately I am having issues with this. Here is the code I have so far.
Set rsRPh = New ADODB.Recordset rsRPh.Open "Select RPhID, firstname + ' ' + MI + '. ' + lastname as salerep from rph where IsSales = 1", adoConn Do While Not rsRPh.EOF cboSalesRep.AddItem rsRPh!salerep cboSalesRep.ItemData(cboSalesRep.NewIndex) = rsRPh!RPhID rsRPh.MoveNext Loop rsRPh.Close Set rsRPh = Nothing If .SalesRep > 0 Then cboSalesRep.ListIndex = .SalesRep End If
Any suggestions are greatly appreciated.