Vba code to show selected data from combobox -


i have access 2010 form has combobox listing 3 columns:

  1. id
  2. first name
  3. 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

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -