Capture user name from a combo box

J

Johnny Bright

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top