Populate text boxes based on 2 combo boxes?

By mwisejay ·
Using ACCESS 2007, I have two combo boxes. The first lists all the Tables in the data base. Each table is a contract where I record monthly costs. Based on the table selected from the first combo box the second combo box lists the ReportingPeriod field from the contract table selected in the first combo box.

Based on the selections from the combo boxes, I have 5 text boxes that need to populate the corresponding data to the record selected in combo box 2 from the table in combo box 1.

The following code populates combo box 1 and is placed in the Row Source:
SELECT Name FROM MSysObjects WHERE Type=1 And Flags=0

The following code populates combo box 2 as an AfterUpdate() event:
Private Sub cboCombo1_AfterUpdate()
cboCombo2.RowSource = "SELECT ReportingPeriod FROM " & cboCombo1
End Sub

I'm trying to autofill the text boxes unsuccessfully using this code under the requery line of the code above:
MonthOfContract = cboCombo1.Column(1)
ActualLaborHours = cboCombo1.Column(5)
ActualLaborCost = cboCombo1.Column(6)
ActualODC = cboCombo1.Column(
ActualTravel = cboCombo1.Column(10)

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Share your knowledge

Related Discussions

Related Forums