Want two fields combined into one

  • Thread starter Thread starter Phillip Schmidt
  • Start date Start date
P

Phillip Schmidt

I am struggling to make this happen, so if someone could
help I would really appreciate it.

I have a form (VLARF Request Forms), and in the form is a
field to input the Employee's name. I would like this to
look at my table of employees and return with the
value "LastName, FirstName" as I start to type in the name.

My employees are listed in the table "Staff Listing"
and "txtFirstName" and "txtLastName" are the respectively
named fields.

Thanks for the help.

Phillip Schmidt
 
Phillip,

You should be storing the EmployeeID unique field in your table, not the
employee name field.
You may have several John Smiths working for the company, but there should
be only one EmployeeID numbered 1234.

Use a combo box. Set the Combo Box row source to something like:
Select [Staff Listing].[EmployeeID], [txtLastName] & ", " & [txtFirstName]
From [Staff Listing]
Order by [txtLastName] & ", " & [txtFirstName];

You should also add a field (or more) that will help narrow down the correct
employee, i.e. Department and/or SSN.

Set the Combo Bound column to 1 (the EmployeeID field)
Set the Column Count property to the number of columns you used above.
Set the Column widths property to:
0";1" plus ;1" for each additional column.
Set the combo Auto Expand property to Yes.
Set the Limit To List property to Yes.

The EmployeeID number will be stored in the table, but the employee full
name will show in the combo box.
You should also consider not using field or table names that have a space
between 2 words.
A table named StaffListing will cause less long term grief than Staff
Listing, and is just as easy to read.
At the very least use Staff_Listing.
 
Back
Top