I will be filitering this list box called ItemsLbx multiple ways. Initially
the user will filter it by an Action Code:
Private Sub ActionLbx_AfterUpdate()
ItemsLbx.RowSource = "SELECT
[ItemID],[EnteredBy],[Level],[Room],[AOR],[System],[Sub],[Own_Arch],[ByActStat],[WTC],[PL],[ProjectNum],[Notes],[Date]" & _
"FROM ItemMasterTbl " & _
"WHERE ItemMasterTbl.ByActStat ='" & ActionLbx.Value
& "'" & _
"AND ItemMasterTbl.ProjectNum ='" & PrjNumTxt.Value&
" '"
Call ActionLbx.Requery
End Sub
Then the user will have the ability to sort it by a few different other
fields based on combo boxes:
Private Sub SrtLevelCbx_AfterUpdate()
ItemsLbx.RowSource = "SELECT
[ItemID],[EnteredBy],[Level],[Room],[AOR],[System],[Sub],[Own_Arch],[ByActStat],[WTC],[PL],[ProjectNum],[Notes],[Date]" & _
"FROM ItemMasterTbl " & _
"WHERE ItemMasterTbl.Level = '" & SrtLevelCbx.Value
& "'" & _
"AND ItemMasterTbl.ByActStat ='" & ActionLbx.Value &
"'" & _
"AND ItemMasterTbl.ProjectNum ='" & PrjNumTxt.Value
& " '"
Call SrtLevelCbx.Requery
End Sub
Private Sub SrtRoomCbx_AfterUpdate()
ItemsLbx.RowSource = "SELECT
[ItemID],[EnteredBy],[Level],[Room],[AOR],[System],[Sub],[Own_Arch],[ByActStat],[WTC],[PL],[ProjectNum],[Notes],[Date]" & _
"FROM ItemMasterTbl " & _
"WHERE ItemMasterTbl.Room = '" & SrtRoomCbx.Value &
"'" & _
"AND ItemMasterTbl.Level ='" & SrtLevelCbx.Value & "
'" & _
"AND ItemMasterTbl.ByActStat ='" & ActionLbx.Value
& "'" & _
"AND ItemMasterTbl.ProjectNum ='" & PrjNumTxt.Value
& " '"
Call SrtRoomCbx.Requery
End Sub
Private Sub SrtAORCbx_AfterUpdate()
ItemsLbx.RowSource = "SELECT
[ItemID],[EnteredBy],[Level],[Room],[AOR],[System],[Sub],[Own_Arch],[ByActStat],[WTC],[PL],[ProjectNum],[Notes],[Date]" & _
"FROM ItemMasterTbl " & _
"WHERE ItemMasterTbl.AOR ='" & SrtAORCbx.Value & "'"
& _
"AND ItemMasterTbl.ByActStat ='" & ActionLbx.Value &
"'" & _
"AND ItemMasterTbl.Room = '" & SrtRoomCbx.Value &
"'" & _
"AND ItemMasterTbl.Level ='" & SrtLevelCbx.Value & "
'" & _
"AND ItemMasterTbl.ProjectNum ='" & PrjNumTxt.Value
& " '"
Call SrtAORCbx.Requery
End Sub
So basically I would want to be able to hit a button at anytime during the
filtering process and just capture whats in the list box. Is there a way i
can get it to do a report and list only item IDs that are currently in the
list box?
Klatuu said:
How did you filter the list box?
The report needs to be filtered the same way.
--
Dave Hargis, Microsoft Access MVP
:
When I do that it prints all the records from the table instead of what was
filtered in the list box.
:
Assuming your list box row source is a table or query, all you need to do is
use the same table or query for the report.
--
Dave Hargis, Microsoft Access MVP
:
I want to show everything that is in the listbox. For example my list box
contains a running list of items that need to be completed on a construction
project. I have a combo box that has all the catagories for the items. If I
select on type of item like "Work In Progress", the list box will show me a
filter of only the "Work In Progress" items. I would like to create a button
that will print out whats currently filtered in that list box.
:
Do you want to include everything in the list box or only selected items?
Is it a multi-select list box?
What else do you want in the report?
--
Dave Hargis, Microsoft Access MVP
:
I have a form that has a listbox wich
displays a filtered table. I would like to print a report of the contents
of that
listbox. This seems like an easy task but I'm struggling here. Can you
help?