• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Excel VBA to extract data from Access field based on criteria

OK, I have a macro I am working on, it will be pulling data from an Access DB Query. What I am trying to figure out is the Access Query has a column for each month. I want to be able to select the month I want VBA to pull into my spreadsheet. Much like checking or unchecking the Show box in the Access query.

So in the Access Query I have a field name of Jan, another of Feb, and so on for each month. Can I use VBA in Excel to pull in only the field name of the month I choose?

Make sense?
 
OK, I found some code but I get this, "Syntax error (missing operator in query expression 'Start Date'.

Referencing this code line:
Code:
rs.Open SQL, con&

Here is the line of code referencing the table names:
Code:
SQL = "SELECT 2015, Service, Start Date, First Year Comm %, Residual Commission FROM " & strTable&[code]
 
Back
Top