Capture user name from a combo box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi there!

I have a 2 column combo box based on an sql statement which takes the
employee ID last name and first as in [strFirst]&", "[strLast]. but of course
is bound to the employee's ID. What I would like to do is capture the
unbound info and put that into a text box so as to capture the employee name
in case the employee ID is deleted if they quit etc.

I've tried this, but it doesn't work.

Dim myDB As DAO.Database
Dim rs As DAO.Recordset


Set myDB = CurrentDb

Set rs = myDB.OpenRecordset("select lngEmpID " _
& "strLast & ", " & strFirst as TheName " _
& "From tblEmps where lngEmpId = " _
& cboUserName, dbOpenSnapshot)

Me.strUserName = rs("TheName")

Me.txtFull = rs("TheName")

Thanks!
 
Back
Top