Question

Locked

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
cboCombo1.Requery
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.

0 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Share your knowledge
Back to Software Forum
0 total posts (Page 1 of 1)  

Related Forums