View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Klatuu Klatuu is offline
external usenet poster
 
Posts: 11
Default RowSource for User Form

I am venturing from an experienced Access/VBA developer to doing some work in
Excel with VBA. I need some help with how to accomplish a specific task.
The objective is that the user needs to enter an employee name and have it
return the Employee Number and Department. This data is in an Access
database table.
I want to use a combo box to make it easy for the user to locate the
employee name and have it fill the cells in the row where the employee data
is.

In looking at how Excel combo boxes work, it says the combo rowsource has to
be a worksheet range. I was hoping a could use a recordset like you do in
Access. But since that does not seem to be available, I came up with this
approach:

Add a new worksheet.
Create the recordset that contains the employee table from the Access database
Use the CopyRecordsetFrom method to copy the row from the recordset into the
new worksheet.
Use the range the data is now in as my rowsource for the combo.
When the user selects a row from the combo, load the other columns' data
into the cells where the data needs to go.

The question is, is this a reasonable approach or is there a better method
to do this?