J
JimS
I have a form with half a dozen subforms (each on its own tab....) I have
combo box on the main form whose record source is different from the form's
record source. When I select an item from the combo box (cbFilterforaMICAP),
here's the code that's fired. Essentially, it filters all the subform
controls for the "MICAP" selected in the combo box.
Private Sub cbFilterforaMICAP_AfterUpdate()
Dim rst As Recordset
Set rst = Me.RecordsetClone
rst.FindFirst "Projectnbr= '" & cbFilterforaMICAP.Column(3) & "'"
If Not rst.EOF Then
Me.Bookmark = rst.Bookmark
End If
Dim lngMICAPID As Long
lngMICAPID = cbFilterforaMICAP.Column(5)
Me.sfmProjectBudgetTab.Form.Filter = "CPMICAPID=" & lngMICAPID
Me.sfmProjectBudgetTab.Form.FilterOn = True
Me.sfmPOLinesTab.Form.Filter = "POMICAPID=" & lngMICAPID
Me.sfmPOLinesTab.Form.FilterOn = True
Me.sfmStaffAugtab.Form.Filter = "MICAP='" & cbFilterforaMICAP.Column(1)
& "'"
Me.sfmStaffAugtab.Form.FilterOn = True
Me.sfmInventoryDetailTab.Form.Filter = "MICAP='" &
cbFilterforaMICAP.Column(1) & "'"
Me.sfmInventoryDetailTab.Form.FilterOn = True
Me.FilterOn = True
' Commented on 06/23/08 by JS
#If False Then
Me.sfmAllMatreqIssuesTab.Form.Filter = ""
Me.sfmAllMatreqIssuesTab.Form.FilterOn = True
Me.sfmAllLaborTab.Form.Filter = ""
Me.sfmAllLaborTab.Form.FilterOn = True
Me.sfmAllPCardTab.Form.Filter = ""
Me.sfmAllPCardTab.Form.FilterOn = True
#End If
'cbFilterforaMICAP = Null
End Sub
Unfortunately, the combo box works, then mysteriously changes value, and
works for that new value. I don't know why that new value shows up, it's not
the first value on the list, though it may be the first MICAP on the newly
current form record.
I commented out the "ON CURRENT" event, and nothing changed, so I've ruled
that out.
Ideas on debugging strategy?
combo box on the main form whose record source is different from the form's
record source. When I select an item from the combo box (cbFilterforaMICAP),
here's the code that's fired. Essentially, it filters all the subform
controls for the "MICAP" selected in the combo box.
Private Sub cbFilterforaMICAP_AfterUpdate()
Dim rst As Recordset
Set rst = Me.RecordsetClone
rst.FindFirst "Projectnbr= '" & cbFilterforaMICAP.Column(3) & "'"
If Not rst.EOF Then
Me.Bookmark = rst.Bookmark
End If
Dim lngMICAPID As Long
lngMICAPID = cbFilterforaMICAP.Column(5)
Me.sfmProjectBudgetTab.Form.Filter = "CPMICAPID=" & lngMICAPID
Me.sfmProjectBudgetTab.Form.FilterOn = True
Me.sfmPOLinesTab.Form.Filter = "POMICAPID=" & lngMICAPID
Me.sfmPOLinesTab.Form.FilterOn = True
Me.sfmStaffAugtab.Form.Filter = "MICAP='" & cbFilterforaMICAP.Column(1)
& "'"
Me.sfmStaffAugtab.Form.FilterOn = True
Me.sfmInventoryDetailTab.Form.Filter = "MICAP='" &
cbFilterforaMICAP.Column(1) & "'"
Me.sfmInventoryDetailTab.Form.FilterOn = True
Me.FilterOn = True
' Commented on 06/23/08 by JS
#If False Then
Me.sfmAllMatreqIssuesTab.Form.Filter = ""
Me.sfmAllMatreqIssuesTab.Form.FilterOn = True
Me.sfmAllLaborTab.Form.Filter = ""
Me.sfmAllLaborTab.Form.FilterOn = True
Me.sfmAllPCardTab.Form.Filter = ""
Me.sfmAllPCardTab.Form.FilterOn = True
#End If
'cbFilterforaMICAP = Null
End Sub
Unfortunately, the combo box works, then mysteriously changes value, and
works for that new value. I don't know why that new value shows up, it's not
the first value on the list, though it may be the first MICAP on the newly
current form record.
I commented out the "ON CURRENT" event, and nothing changed, so I've ruled
that out.
Ideas on debugging strategy?