Vba code to show selected data from combobox -
i have access 2010 form has combobox listing 3 columns:
- id
- first name
- last name
the combo box bound table containing data. id column in combo box hidden, shows first , last name.
when user selects row the first name shown. in property section, chose:
- column count: 3
- column widths:0;3,3
- bound column: 1
i made text field , in combobox wrote following vbcode:
text=combo.value
that shows in text field chosen id.
i want show in field (text\combo?) last name. how can that?
well did recordset. if know simpler solution, glad lrn. code:
dim dbs adodb.connection dim id string set dbs = currentproject.accessconnection set rsrep = new adodb.recordset set rsrep.activeconnection = dbs rsrep.open "tblrep" id = me.cbprvfirstname rsrep.movefirst rsrep.find "repid=" & id me.txtprvlastname = rsrep.fields(2) rsrep.close
Comments
Post a Comment