How to use recordset efficientlly in Excel VBA

Hi,
Generally i don't work a lot with Excel VBA but I've been assigned a task to create some reports in excel using VBA...
Your help would be appreciate a lot....
Namelly, I should get data from SQL Server database, and my concept would be to get all data from xyz table from SQL Server in ADO recordset and then to disconect from the database...
In terms to get data in excel spreadsheet I would create different userforms in order to provide end users to define parameters which will be used to filter data in previously loaded recordset and then represented on worksheet itself...
Unfortunytelly, I was not able to find any good example how to pass parameters in recordset to get data filtered...

Here is clarification what I would like to achieve:

1. step load recordset like connect to SQL Server database and execute query "Select * from my_table" in order to populate recordset (ok this is not the issue)
2. step - After end user define parameters on the user form then I should execute query against recordset from step 1 which would look like "Select * from recordset where parameter1 = 'My_value' and parameter2 in ('My_value2',''My_value3')"

Can anyone help me in order to provide me with the example how to make this working (if possiblle)..

Thanks a lot...
LVL 1
alsamAsked:
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.

Rory ArchibaldCommented:
You cannot execute a query against a recordset, but you can apply filters to it. Personally, I suspect it would be more efficient to requery the database after the parameters are set rather than loading the entire table into memory, especially if you have a lot of data.
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
alsamAuthor Commented:
Ok rorya,
I just wanted expert opinion about this....generally my goal was to release resources by disconecting end user from the database (or to limit to the minimum possibble connection attempts as possibble)...
Anyway, with your suggested approach then I should not have problems and no further assistance would be required....I'm going to leave behind my original idea...
Ok, I would leave this question open just for a short while (until tomorrow) in case someone else has to share experience regarding the issue...
Thanks for your time and effort....
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 Development

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.