Filter Subform Datasheet in an easier way

  • Thread starter mattc66 via AccessMonster.com
  • Start date
M

mattc66 via AccessMonster.com

I am looking for suggestion on an easier way or the correct way to perform
these tasks.

I have a main form with a subform datasheet.

The LinkChild and Master are based on up to 4 drop down lists on the main
form.

When you first open the main form your required to make a selection from each
of the 4 drop downs.

However what I'd like to do is be able to allow them to show all from any and
all combination of the drop down lists. What I did was to add a check box
next to each drop down. When this is checked that drop down list is not
required.

I have the below code on the click event. With all the combinations if on is
check or all 4 are checked or 2 of the 3 are checked. I think there is a
better way. Any suggestions?

Private Sub ckAllBrands_Click()

Dim stLinkChild As String
Dim stLinkMaster As String

If ckAllBrands = True Then

Me.ckAllModels = Null

stLinkChild = "MonthShipped;WoodType;ModelType"
stLinkMaster = "cboMonthShipped;cboWoodType;cboModelType"

Me.cboBrand = "ALL"

Me.frmShopOrderSqFtShippedSummaryRpt.LinkChildFields = ""
Me.frmShopOrderSqFtShippedSummaryRpt.LinkMasterFields = ""

Me.frmShopOrderSqFtShippedSummaryRpt.LinkChildFields = stLinkChild
Me.frmShopOrderSqFtShippedSummaryRpt.LinkMasterFields =
stLinkMaster
Me.Refresh

Else
ckAllBrands = False

stLinkChild = "Brand;MonthShipped;WoodType;ModelType"
stLinkMaster = "cboBrand;cboMonthShipped;cboWoodType;cboModelType"
Me.cboBrand = "Select Brand"
'Me.cboModelType = "Select Model"

Me.frmShopOrderSqFtShippedSummaryRpt.LinkChildFields = ""
Me.frmShopOrderSqFtShippedSummaryRpt.LinkMasterFields = ""

Me.frmShopOrderSqFtShippedSummaryRpt.LinkChildFields = stLinkChild
Me.frmShopOrderSqFtShippedSummaryRpt.LinkMasterFields =
stLinkMaster
Me.Refresh

End If

End Sub
 
Top