Hello,
I am attempting to create a nested loop (in Access 2003/VB) that will print a report for a set of user defined months inputed on a form and that will print out for every Client. So the first loop would increment the Client by 1, then the second loop would increment the Month by 1. So the first time around Client A for Month 1, then Client A for month 2 then Client B for Month 1 and so on. Below is what I have already, I can get the nested loop to work and increment the months, but am having a heck of a time incrementing the outer loop (Client). Below is my code so far. Thanks in advance for your help.
I am attempting to create a nested loop (in Access 2003/VB) that will print a report for a set of user defined months inputed on a form and that will print out for every Client. So the first loop would increment the Client by 1, then the second loop would increment the Month by 1. So the first time around Client A for Month 1, then Client A for month 2 then Client B for Month 1 and so on. Below is what I have already, I can get the nested loop to work and increment the months, but am having a heck of a time incrementing the outer loop (Client). Below is my code so far. Thanks in advance for your help.
Code:
Private Sub Print_All_SB165_Click() Dim stDocName As String stDocName = "CFDMonthlyReportALLMONTH" Dim i As Integer i = 1 Dim x As Integer x = 0 Do Do While Forms!ReportChooser!AllMonth.ItemData(x) <> "" Forms!ReportChooser!Month = Forms!ReportChooser!AllMonth.ItemData(x) Forms!ReportChooser!Client_Box = Forms!ReportChooser!Client_All.ItemData(i) DoCmd.RunMacro "OpenQNOTE" DoCmd.OpenReport stDocName, acNormal DoCmd.RunMacro "CloseQNOTE" x = x + 1 Loop i = i + 1 Loop Until Forms!ReportChooser!Client_Box.ItemData(i) = "" End Sub
Comment