Hello,
I have a For Next statement that I use to cycle through a list of variables. These variables populate a textbox on my form. Once this textbox is populated, i have other listboxes autopopulate based on a query result. My issue is that not every variable will have results in the query, therefore, I want to skip these and move on to the next iteration. I am having some trouble getting an If statement to work here as the continue for will not work, and I cannot get a goto statement to work here.
Here is my code:
Any help is appreciated.
Thanks,
Cris
I have a For Next statement that I use to cycle through a list of variables. These variables populate a textbox on my form. Once this textbox is populated, i have other listboxes autopopulate based on a query result. My issue is that not every variable will have results in the query, therefore, I want to skip these and move on to the next iteration. I am having some trouble getting an If statement to work here as the continue for will not work, and I cannot get a goto statement to work here.
Here is my code:
Code:
Dim PMOLead(1 To 8)
PMOLead(1) = "abc1"
PMOLead(2) = "abc2"
PMOLead(3) = "abc3"
PMOLead(4) = "abc4"
PMOLead(5) = "abc5"
PMOLead(6) = "abc6"
PMOLead(7) = "abc7"
PMOLead(8) = "abc8"
For i = 1 To 8
txtPMOLead_Box = PMOLead(i)
If LeadEmail = Null Then GoTo NextIteration
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "PastDue", Path & "\YTD Past Due_" & PMOLead(i) & "_" & ".xlsx", True
sendemail
Next i
'Notify completion
MsgBox "Export Complete", vbOKOnly, "Export Notification"
'Turn on Warnings
DoCmd.SetWarnings True
Any help is appreciated.
Thanks,
Cris