Auto Populate Access Form Fields Dependent on Combo Box Selection

Gentlemen:
In access I have a form with a combo box to select employee names. The Data Source table has also columns for the Employee's Manager and Department Head.

If I select the Emp Name in the combo box, whats the best method to auto-populate the associated values for Manager and Dept Head, similar to a vlookup in Excel? I know that dlookup would work but Im thinking VBA is better because Dlookup can be slow.
 
thanks
RonBudget AnalystAsked:
Who is Participating?
 
PatHartmanConnect With a Mentor Commented:
Here's a database that shows three methods.  See the fourth example
FillFormFields.zip
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
In VBA ... you can refer to Columns other than the Bound Column (usually physical column one) with the Column Property

Dim x
x = Me.ComboName.Column(2) ' refers to physical three.

NOTE: In VBA code, the Column Property is ZERO based. So, physical column one is Column(0) in code
0
 
RonBudget AnalystAuthor Commented:
Perfect Thanks
0
 
PatHartmanCommented:
You're welcome.  Please close the question if that solved your problem.
0
 
PatHartmanCommented:
answer accepted
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.