Combo Box after update, populates next field?

michaeljohannes

Registered User.
Local time
Yesterday, 21:28
Joined
May 3, 2007
Messages
67
Hello,

I am looking for a way to populate a field in a form based on a combo box result entered immediately before. (dependent/independent combo box setup)

This is what I have right now...

Two tables:

FullName Wages
--------- -------
FullNameID FullNameID
FullName Wage

I then created a query to join the two tables:

FullName_Wages
----------------
FullName.FullNameID
FullName
Wage


The combo box in the subform cboFullName draws the results of the query and displays the FullName and enters it into a control on my subform (WageTableSubform).

This all works!

How can I get the combo box to automatically (AfterUpdate) enter that person's wage into the next control on the form (HourlyWage)?

The query works, the tables are linked properly and I have a bit of VB code already in the cboFullName AfterUpdate sub that says

Me.HourlyWage.Requery

What I can't seem to wrap my head around is the SQL WHERE clause to make it all happen. I'm sure this is simple, but I need some help to make it work.

Thank you for your help!

Michael.
 
Are you planning to have the HourlyWage in more than one table?
 
Yes.. I realize it's not ideal to store the same data twice. But for the sake of this exercise, yes, the hourly wage will be stored twice...
 
You can reference any column in a ComboBox with the Column() property. Me.ComboBoxName.Column(2) would reference the 3rd column since the index is zero based.
 
Cheers! Works brilliantly. I love it when VB code is this "basic".

8300 feet in Colorado? I live in Denver! :)
 

Users who are viewing this thread

Back
Top Bottom