Question : Join Access files within one folder

Hi,

I have 14 access files (access databases) located in one folder.
Now every access file contains 5 different tables: Users, Accounts, Payroll, Begining_Balance, Closing_Balance.
 All the tables have the same headers and formats in all 14 Access files.

How do I join all those tables into 5 final tables (one Access file)?
I also need to add a field to each table which will contain the name of the file (database) to identify where particular data is coming from.

Please, feel free to ask any questions if you need more clarification on this.

Thank you.

J.

Answer : Join Access files within one folder

CurrentDb.Execute "INSERT INTO " & CStr(varTableName) & "SELECT *,  '" & Right(CStr(varDbName), InStrRev(varDbName, "\") + 1) & "' As TheAdditionalFieldName  FROM " & CStr(varTableName) & " IN " & CStr(varDbName) & ";"

Change "TheAdditionalFieldName" to the actual field name.

"Please, make sure that code you send has a correct syntax as I am not a VB macro expert."
I am not in front of your computer and I do not have your problem in mine so I cannot debug the code. If you do not want my free help, just tell me and I will stop.

The purpose of EE is to provide help to fellow computer users. Not to get others to do able the work for free.
Random Solutions  
 
programming4us programming4us