List Box to run multiple queries

My question is a bit confusing, but I will try to explain. I have a list box (called "LstAvailQry" and muli-select is enabled to SIMPLE). The list displays several rows of data showing my available queries.  For example:
Query      Description
Query1    Show all employees Name and Address
Query2   [Show number of referrals by shift]
Query3    Show number of declined referrals by shift
Query4   [Show list of referrals closed by employee]

I want the user to be able to select multiple rows of data and click on a run button. The run button will then run all queries selected.  For example, if I select Queries 2 & 4, the application will run these two queries for me to view.

As I saw some samples in previous question and I believe they use the loop function, but I am not sure how to do that in my case.

Could you kindly provide some code that will run these queries?
 

Thanks
epicazoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

harfangCommented:
Private Sub cmdRun_Click()

    Dim varItem

    For Each varItem In lstAvailQry.ItemsSelected
        Docmd.OpenQuery lstAvailQry.ItemDate(varItem)
    Next varItem

End Sub
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
epicazoAuthor Commented:
I get an error, method or data member not found... lstAvailQry.ItemDate(varItem)
0
epicazoAuthor Commented:
it was just a typo on itemdata().

     Docmd.OpenQuery lstAvailQry.ItemData(varItem)

 I corrected it -- thank you so much.
0
dan_vellaCommented:
In case that doesn't work:


For Each qry In Me.LstAvailQry.ItemsSelected
DoCmd.OpenQuery qry
Next
0
harfangCommented:
:)
My fingers often confuse "date" and "data"... good job!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.