Skip to content
Advertisement

Excel VBA – ADO Connection to MS Access DB – Filtering results

I have a MS Access Database where I store some information of products and I have these fields:

ID, Customer Part No., Description, Price, Observations

I also have an Excel file where I have a column called Customer Part No. and in this column I paste the Customer’s Part I want to filter.

I need a way to make a query to my access DB using Excel and VBA to return only the records where I have a match between in the Customer Part No.

At the moment I managed to connect to the database and retrieve all records. However I still didn’t figured out how to select only the records where I have a match, I imagine it would be something in the SQL query but I don’t know how it would go.

Advertisement

Answer

Found the solution in case anyone is interested:

Below is my code:

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement