View Single Post
  #3  
Old May 28th, 2010, 01:36 PM posted to microsoft.public.access
David G.[_3_]
external usenet poster
 
Posts: 60
Default Name searching problem

Thanks! Works perfect.

On Thu, 27 May 2010 19:07:02 -0600, John W. Vinson
wrote:

You're missing the most powerful feature of Access: Queries.

You certainly do NOT need to, nor should you, have the full name stored in any
table, in either format!

Your employee table should have fields such as EmployeeID (a unique, stable,
primary key), LastName, and FirstName.

You can base two combo boxes on two queries based on this table, using your
expressions as calculated fields in the query, and the EmployeeID as the bound
column. These queries will dynamically retrieve whatever names are currently
in the table - that's what queries are *for*. Nothing is needed to "keep the
table current" or "rebuild".

You could even include every name in the combo's rowsource twice, once each
way, using a UNION query. Given the above table design, you can go to the SQL
window of a new query and edit it to

SELECT EmployeeID, [LastName] & ", " & [Firstname] FROM Employees
UNION ALL
SELECT EmployeeID, [FIrstName] & " " & [Lastname] FROM Employees
ORDER BY 2;

The 2 means to order by the second field (the full name). Use this query as
the combo's rowsource.

THANKS!
David G.