Loop through third list box

B

beamer

Hey,
wondering if someone can help with this loop. I have 3 list boxes
list0 lists departments, list6 lists reports, and list138 lists jo
titles within each department (updates when new department i
selected).
I have a loop that loops through list6 and prints all reports for th
department selected in list0. But, with the addition of this thir
list box: list138, I need to loop through list138 automatically onc
the loop is done on list6. Code is below. Thanks in advance for an
assisstance.


Dim loopcount As Integer, x As Integer
Dim intCurrentRow As Integer
Dim chosenone As Boolean

chosenone = False


For intCurrentRow = 0 To List0.ListCount - 1

If List0.Selected(intCurrentRow) Then
Text2 = List0.Column(2, intCurrentRow)
Text4 = List0.Column(1, intCurrentRow) & " " & List0.Column(0
intCurrentRow)

DoCmd.SetWarnings False
DoCmd.OpenQuery "Q_ReportIndvDel"
DoCmd.OpenQuery "Q_ReportIndvAdd"
DoCmd.SetWarnings True
'**** give the focus to the listbox

List6.SetFocus

'***** get the number of iterations and subtract 1 because 0 i
the first line of the list
loopcount = List6.ListCount - 1

'*****set it to first row, issue the click and print th
report


If Check101 = False Then
List6.ListIndex = 0
List6_Click
Command10_Click

'***** Loop through the rest

For x = 1 To loopcount
List6.ListIndex = List6.ListIndex + 1
List6_Click
Command10_Click


Next x

End If

End If
Next intCurrentRo
 

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