cheekykevwalker
Programmer
With the below code I populate a datacombo box from a recordset. I use 'allname' as a combined field so that I can have surname and forename in the datacombo box as a single value, I also select 2 more SQL fields that get the staff ID and staff team and staff group fields but these are not shown in the datacombo box (hidden from user).When the user selects a different name from the populated combo box the relevant staff_id changes automatically because it has been bound to the correct table value but how can I make the other two staff, group and team fields change in the table when the name is changed? Thanks in advance! Kev
Code:
'***Populate the name and Surname Combo Box*****
Set rsHmtStaff = New Recordset
strHmtStaffSQL = "select allname=surname + ' ' + forename, staff_id, short_directorate, short_team from tbl_staff order by allname"
rsHmtStaff.CursorLocation = adUseClient
rsHmtStaff.Open strHmtStaffSQL, cn, adOpenForwardOnly, adLockReadOnly
Set lsthmtstaff.RowSource = rsHmtStaff
lsthmtstaff.ListField = "allname"
lsthmtstaff.BoundColumn = "staff_ID"
Set lsthmtstaff.DataSource = rsContacts
lsthmtstaff.DataField = "hmtstaff"
[\code]