I always ask questions here and never really know how to word them!

I have a necessary flow of data.

Access Database
Excel VBA code

The sql server has a login and password that has to be entered. The access database links to two tables on the sql server, it has 1 table that is static (updated weekly). There is a query to combine parts from ALL THREE objects. This is why I am using VBA to access MS Access, run the query, and pull put the data in Excel. When you run the query in MS Access you have to type in a password (because of the two linked tables).

I wrote the following code, it executes fine. However, i need to be able to pass the Password to Access for the query to run. Does anyone know how to do that? **Keep in mind this code is not finished, I'm just starting with it, also I removed confidential information**

Please Login or Register  to view this content.
It doesn't stop there! I need to be able to make that query have user inputed paramaters. I have two functions StartDate and Endate, where the user puts in a start date and end date into input boxes. I need the query to only pull between SDate and Edate, how would the Excel VBA SQL look for that?

ANY help would be much appreciated.