Running a report of a filtered listbox

M

mreckley

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!
 
D

Dale Fye

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?
 
M

mreckley

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!
 
M

mreckley

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top