View Full Version : Help Needed with Multiple Combo Box filters.


KeeF_J
04-02-2009, 12:40 AM
Hi,
I'm new to both m$ Access and VBA programming but have been tasked with building an Asset register at work..

I have created a main form with subform with multiple combo boxes that i need to act as individual and combinable filters for the asset register..

I have spent the whole of the last week looking through various websites and ebooks and still cant seem to get it to work.. (like i said im new to this sort of thing..)

can someone please explain what im doing wrong i have attached my db so you can see where i going with it..

Many thanks for you time and help..

Regards
KeeF

KeeF_J
04-02-2009, 02:49 AM
ok.. i've managed to get each of the filters to work individually using the following VBA

Private Sub cboStore_AfterUpdate()
Dim strSQL As String


strSQL = " SELECT * FROM AssetLog "
strSQL = strSQL & " WHERE AssetLog.BranchNUMBER = '" & cboStore & "';"



Me!AssetSF.LinkChildFields = "BRANCHNUMBER"
Me!AssetSF.LinkMasterFields = "BRANCHNUMBER"
Me.RecordSource = strSQL
Me.Requery
End Sub
Private Sub cbolocation_AfterUpdate()
Dim strSQL As String


strSQL = " SELECT * FROM AssetLog "
strSQL = strSQL & " WHERE AssetLog.BranchLocation = '" & cbolocation & "';"



Me!AssetSF.LinkChildFields = "BRANCHLOCATION"
Me!AssetSF.LinkMasterFields = "BRANCHLOCATION"
Me.RecordSource = strSQL
Me.Requery
End Sub
Private Sub cboproduct_AfterUpdate()
Dim strSQL As String


strSQL = " SELECT * FROM AssetLog "
strSQL = strSQL & " WHERE AssetLog.ProductType = '" & cboproduct & "';"



Me!AssetSF.LinkChildFields = "PRODUCTTYPE"
Me!AssetSF.LinkMasterFields = "PRODUCTTYPE"
Me.RecordSource = strSQL
Me.Requery
End Sub

and so-on until all combo boxes are covered..

so all i gotta do now is tie them together so combo box 1 and 3 ect. will work in conjunction with each other