AGAIN, why are you looping a control for a single report name?
AGAIN, why are you looping a control for a single report name?
Please use # icon on toolbar when posting code snippets.
Cross Posting: https://www.excelguru.ca/content.php?184
Debugging Access: https://www.youtube.com/results?sear...bug+access+vba
Hi Welshgasman,
I am not looping though the report name. It is selecting the report name, then it loops through the other list box to filter it.
Not sure what you are looking at? I have a report List box with names of reports (Not MultiSelect)
Then I have three multi select list boxes to filter out my criteria for report if needed, and that loops the last listbox, "Function's As"
Which filters out the report.
Thanks
Dave
What do you call this then?
Let's say that the number of reports grow substantially to over 50. You are looping through 50 entries to find a single one that is selected.Code:With Me.LstBusinessReport For Each varItem In .ItemsSelected strDoc = .Column(1, varItem) 'assumes list box has two columns, the first one holding the reportID is the bound one and hidden Next End With
Yes, computers are fast, but I myself have an issue with redundant code.
For a single select listbox, just use the Me.LstBusinessReport providing that is the bound field, or the relevant column if not.
Please use # icon on toolbar when posting code snippets.
Cross Posting: https://www.excelguru.ca/content.php?184
Debugging Access: https://www.youtube.com/results?sear...bug+access+vba
Hi Welshgasman,
I will have to try that. I got the origional code from Allen Brown and not sure why he wrote that way as we all know you can open one report at a time, or at least to my knowledge.
In any event, I will give that a shot and see how it works as your example.
Thanks
Dave
I am pretty sure AB would not loop code for the sake of it.Hi Welshgasman,
I will have to try that. I got the origional code from Allen Brown and not sure why he wrote that way as we all know you can open one report at a time, or at least to my knowledge.
In any event, I will give that a shot and see how it works as your example.
Thanks
Dave
So you have copied that from another process when it is not required.
Yes, you need to do that for all the entries that are criteria, but not for the report.
FWIW, I did test trying to open two reports and Access took them to be the name of a single report.
Please use # icon on toolbar when posting code snippets.
Cross Posting: https://www.excelguru.ca/content.php?184
Debugging Access: https://www.youtube.com/results?sear...bug+access+vba