Can someone PLEASE show me how to set the property for each item in a combo box. Here is how I am addint items to the combo box and at the same time I want to store V_id in the TAG for each ITEM.
Then I want to read the TAG back when ever an item is clicked on. So please tell me how to read it back. I hope it could be very simple like Combobox.selecteditem.teg or something but since I never used it, I am not familiure with it. thanks.
VB Code:
Private Sub Get_vehicles() Dim sSQL As String, cn As ADODB.Connection, rs As ADODB.Recordset Dim str As String, Ind As Long Set cn = New ADODB.Connection 'weve declared it as a ADODB connection lets set it. cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source= c:\vra\RentalManager.mdb" 'this is the connection string. cn.Open Set rs = New ADODB.Recordset sSQL = "SELECT V_id, Year, Make, Model, Color FROM Vehicles " sSQL = sSQL & "ORDER BY Make, Model" Set rs = cn.Execute(sSQL) Do Until rs.EOF = True str = Right(rs.Fields("Year"), 2) & " " & Trim(rs.Fields("Make")) & " " str = str & Trim(rs.Fields("Model")) & " " & Trim(rs.Fields("Color")) HistCombBx.AddItem str HistCombBx If rs.Fields("V_id") = Vehicle_id Then Ind = HistCombBx.ListCount rs.MoveNext Loop rs.Close Set rs = Nothing Set cn = Nothing HistCombBx.ListIndex = Ind - 1 End Sub


Reply With Quote
