Repopulating form with combo boxes in subform

  • Thread starter Rklein via AccessMonster.com
  • Start date
R

Rklein via AccessMonster.com

In Access 2003, I have a form that contains all user entered information. The
form (Form1) gives the user the option to “Save†current data, to be recalled
later by an “Open†button. The “Open†button is a pop-up form of all records
“saved†and has the user select one to open, repopulating the form by the
unique key selected.

Code for the “Open†button is as follows:

Dim strFilter As String
PID = Me.List11 [List11 = pop-up form combo box]
strFilter = "(ParentID =" & PID & ")"
Forms!form1.FilterOn = True
Forms!form1.Filter = strFilter
Forms!form1.Requery

My problem is that, within the form, I have a subform (HeaderDeductCodes)
that contains two combo boxes, Deduction_Type and Deduction_Description,
which is populated based on what option is selected in Deduction_Type. When
the form is repopulated, Deduction_Type is populated with the correct data,
but the Deduction_Description combo boxes are blank, even though the correct
data is stored in the table(s).
The code to populate the Deduction_Description is built into the After Update
code of the Deduction_Type:

Private Sub Deduction_Type_AfterUpdate()

Me.Deduction_Description = Null
Me.Deduction_Description.RowSource = "SELECT DeductDescTable.TblID,
DeductDescTable.DeductDesc, DeductDescTable.DescripID, DeductDescTable.Rate
FROM DeductDescTable WHERE (((DeductDescTable.TblID)=[forms]![form1]!
[HeaderDeductCodes]![tableid]));"
'Me.Deduction_Description.Requery
Me.Deduction_Description.Value = 0

End Sub

Is there a way I can get the Deduction_Description to populate correctly? If
I need to go into more explanation, let me know.
 
C

Carl Rapson

You may need to add the code to the form's Current event also. AfterUpdate
will only fire when Deduction_Type is changed by the user.

Carl Rapson
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top