Page 2 of 2 FirstFirst 12
Results 16 to 20 of 20
  1. #16
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,858

    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

  2. #17
    d9pierce1 is offline Expert
    Windows 10 Access 2019
    Join Date
    Jan 2012
    Location
    Oklahoma
    Posts
    754
    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

  3. #18
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,858
    What do you call this then?
    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
    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.
    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

  4. #19
    d9pierce1 is offline Expert
    Windows 10 Access 2019
    Join Date
    Jan 2012
    Location
    Oklahoma
    Posts
    754
    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

  5. #20
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,858
    Quote Originally Posted by d9pierce1 View Post
    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.
    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

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 08-06-2015, 03:26 PM
  2. Replies: 1
    Last Post: 02-21-2015, 11:35 PM
  3. Replies: 15
    Last Post: 04-09-2014, 02:29 PM
  4. Hiding buttons on Print of Report
    By CS_10 in forum Reports
    Replies: 3
    Last Post: 04-08-2014, 07:52 AM
  5. Replies: 1
    Last Post: 12-03-2012, 03:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums