Running a report of a filtered listbox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form that will filter a list of items into a listbox called ItemsLbx
based on the selection of several comb boxes. I would like to create a
button that will print out whatever the currnet filter is on that list box
after I have done my comb box slections. here is my code:


Private Sub ProjectLbx_AfterUpdate()
On Error Resume Next
ItemsLbx.RowSource = "SELECT
[ItemID],[EnteredBy],[Level],[Room],[AOR],[System],[Sub],[Own_Arch],[ByActStat],[WTC],[PL],[ProjectNum],[Date]" & _
"FROM ItemMasterTbl " & _
"WHERE ItemMasterTbl.ProjectNum = '" &
ProjectLbx.Value & "'"


Call ProjectLbx.Requery

End Sub

Private Sub SrtLevelCbx_AfterUpdate()
ItemsLbx.RowSource = "SELECT
[ItemID],[EnteredBy],[Level],[Room],[AOR],[System],[Sub],[Own_Arch],[ByActStat],[WTC],[PL],[ProjectNum],[Date]" & _
"FROM ItemMasterTbl " & _
"WHERE ItemMasterTbl.Level = '" & SrtLevelCbx.Value
& "'" & _
"AND ItemMasterTbl.ProjectNum ='" & ProjectLbx.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],[Date]" & _
"FROM ItemMasterTbl " & _
"WHERE ItemMasterTbl.Room = '" & SrtRoomCbx.Value &
"'" & _
"AND ItemMasterTbl.Level ='" & SrtLevelCbx.Value & "
'" & _
"AND ItemMasterTbl.ProjectNum ='" & ProjectLbx.Value
& " '"
Call SrtRoomCbx.Requery
End Sub


Any help you can give will be greatly appreciated!
 
Do you mean that you want to print out the text of the SQL string, or run the
query and print out what actually gets passed to the listbox?
 
I would like to print out what is actually passed to the listbox.

Dale Fye said:
Do you mean that you want to print out the text of the SQL string, or run the
query and print out what actually gets passed to the listbox?

--
Email address is not valid.
Please reply to newsgroup only.


mreckley said:
I have a form that will filter a list of items into a listbox called ItemsLbx
based on the selection of several comb boxes. I would like to create a
button that will print out whatever the currnet filter is on that list box
after I have done my comb box slections. here is my code:


Private Sub ProjectLbx_AfterUpdate()
On Error Resume Next
ItemsLbx.RowSource = "SELECT
[ItemID],[EnteredBy],[Level],[Room],[AOR],[System],[Sub],[Own_Arch],[ByActStat],[WTC],[PL],[ProjectNum],[Date]" & _
"FROM ItemMasterTbl " & _
"WHERE ItemMasterTbl.ProjectNum = '" &
ProjectLbx.Value & "'"


Call ProjectLbx.Requery

End Sub

Private Sub SrtLevelCbx_AfterUpdate()
ItemsLbx.RowSource = "SELECT
[ItemID],[EnteredBy],[Level],[Room],[AOR],[System],[Sub],[Own_Arch],[ByActStat],[WTC],[PL],[ProjectNum],[Date]" & _
"FROM ItemMasterTbl " & _
"WHERE ItemMasterTbl.Level = '" & SrtLevelCbx.Value
& "'" & _
"AND ItemMasterTbl.ProjectNum ='" & ProjectLbx.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],[Date]" & _
"FROM ItemMasterTbl " & _
"WHERE ItemMasterTbl.Room = '" & SrtRoomCbx.Value &
"'" & _
"AND ItemMasterTbl.Level ='" & SrtLevelCbx.Value & "
'" & _
"AND ItemMasterTbl.ProjectNum ='" & ProjectLbx.Value
& " '"
Call SrtRoomCbx.Requery
End Sub


Any help you can give will be greatly appreciated!
 
Is it possible to do this?

mreckley said:
I would like to print out what is actually passed to the listbox.

Dale Fye said:
Do you mean that you want to print out the text of the SQL string, or run the
query and print out what actually gets passed to the listbox?

--
Email address is not valid.
Please reply to newsgroup only.


mreckley said:
I have a form that will filter a list of items into a listbox called ItemsLbx
based on the selection of several comb boxes. I would like to create a
button that will print out whatever the currnet filter is on that list box
after I have done my comb box slections. here is my code:


Private Sub ProjectLbx_AfterUpdate()
On Error Resume Next
ItemsLbx.RowSource = "SELECT
[ItemID],[EnteredBy],[Level],[Room],[AOR],[System],[Sub],[Own_Arch],[ByActStat],[WTC],[PL],[ProjectNum],[Date]" & _
"FROM ItemMasterTbl " & _
"WHERE ItemMasterTbl.ProjectNum = '" &
ProjectLbx.Value & "'"


Call ProjectLbx.Requery

End Sub

Private Sub SrtLevelCbx_AfterUpdate()
ItemsLbx.RowSource = "SELECT
[ItemID],[EnteredBy],[Level],[Room],[AOR],[System],[Sub],[Own_Arch],[ByActStat],[WTC],[PL],[ProjectNum],[Date]" & _
"FROM ItemMasterTbl " & _
"WHERE ItemMasterTbl.Level = '" & SrtLevelCbx.Value
& "'" & _
"AND ItemMasterTbl.ProjectNum ='" & ProjectLbx.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],[Date]" & _
"FROM ItemMasterTbl " & _
"WHERE ItemMasterTbl.Room = '" & SrtRoomCbx.Value &
"'" & _
"AND ItemMasterTbl.Level ='" & SrtLevelCbx.Value & "
'" & _
"AND ItemMasterTbl.ProjectNum ='" & ProjectLbx.Value
& " '"
Call SrtRoomCbx.Requery
End Sub


Any help you can give will be greatly appreciated!
 
Back
Top