Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update subform after clicking combo box

Status
Not open for further replies.

eHigh

Programmer
Nov 25, 2002
43
US
I would like to update 3 textboxes on a subform1 after clicking a combo box on another subform2. Both subforms are on one Main form. I can update the controls for the first record on the subform with the code below. But when I attempt to create a second record by clicking on the combo box on subform2 I cannot update the controls on subform1 for the second record.

Private Sub cboIndex_AfterUpdate()
Forms![MainForm]![SubForm1].Form![Org] = DLookup("[Org]", _
"tblIndex", "Index = '" & [cboIndex] & "'")
Forms![MainForm]![SubForm1].Form![cboFund] = DLookup("[Fund]", _
"tblIndex", "Index = '" & [cboIndex] & "'")
Forms![MainForm]![SubForm1].Form![Program] = DLookup("[Program]", _
"tblIndex", "Index = '" & [cboIndex] & "'")
End Sub

Any suggestions would be appreciated.
 
Hallo,

Could you provide a bit more info?
You say you want to update 3 text boxes, then you mention creating records from the combo box.
Are you saying that the fields are updated correctly the first time you use the combo box, then are not updated for the second time you use the combo box?
What error message do you get?

Also, your code would seem to indicate that the Index field in tblIndex is a text field. Is this true?

- Frink
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top