kahmed1985
New member
- Local time
- Today, 07:10
- Joined
- Jan 9, 2013
- Messages
- 5
Hi, I am new to this forum and would really appreciate some help please. I am trying to use VBA to take a value from a dropdown combo box in a form, and use it to filter a query. I am able to get the value of the dropdown into vba, but am getting stuck applying it as a filter. Here is some details..
The (simplified) data from my query output:
Season, Team, Won, Draw, Loss, Pts
2006-07, Liverpool, 1, 0, 0, 3
2006-07, Manchester, 0, 0, 1, 0
2007-08, Liverpool, 0, 1, 0, 1
2007-08, Manchester, 0, 1, 0, 1
So my filter is the season, eg, 2006-07, and I want to see the table, where I want to see Liverpool with 3 pts, and Manchester with 0 pts, but I am getting Liverpool 4 pts, and Manchester 1 pts. i.e. nothing is being filtered
This is the basis what i've put into VBA, which I think is fine as it opens the report (which is based on above query), but I've no idea what to do next and I've tried a lot of random things that I've found on the net with no success
Dim MTable As String
Dim MSeason As String
MSeason = Forms!Menu!Season
MTable = "Table" & MSeason
DoCmd.OpenReport MTable, acViewReport
This would really simplify my database, otherwise I will end up with multiples and multiples of queries
The (simplified) data from my query output:
Season, Team, Won, Draw, Loss, Pts
2006-07, Liverpool, 1, 0, 0, 3
2006-07, Manchester, 0, 0, 1, 0
2007-08, Liverpool, 0, 1, 0, 1
2007-08, Manchester, 0, 1, 0, 1
So my filter is the season, eg, 2006-07, and I want to see the table, where I want to see Liverpool with 3 pts, and Manchester with 0 pts, but I am getting Liverpool 4 pts, and Manchester 1 pts. i.e. nothing is being filtered
This is the basis what i've put into VBA, which I think is fine as it opens the report (which is based on above query), but I've no idea what to do next and I've tried a lot of random things that I've found on the net with no success
Dim MTable As String
Dim MSeason As String
MSeason = Forms!Menu!Season
MTable = "Table" & MSeason
DoCmd.OpenReport MTable, acViewReport
This would really simplify my database, otherwise I will end up with multiples and multiples of queries