Go Back   Access World Forums > Microsoft Access Discussion > Modules & VBA

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 02-15-2016, 03:39 AM   #1
memaxt
Newly Registered User
 
Join Date: Mar 2013
Posts: 62
Thanks: 12
Thanked 0 Times in 0 Posts
memaxt is on a distinguished road
VBA union all tables in database

Hi there,

I have a list of tables like this:

January_2014
February_2014
March_2014
...

Is there away I can create union within VBA that will search for tables like the above and add them to a union query or append them to a master table?

Users will be importing a new table each month so I need the VBA to pick new month tables

Kindest regards
Max

memaxt is offline   Reply With Quote
Old 02-15-2016, 04:14 AM   #2
Grumm
Newly Registered User
 
Join Date: Oct 2015
Location: On a planet in space
Posts: 285
Thanks: 14
Thanked 59 Times in 58 Posts
Grumm is on a distinguished road
Re: VBA union all tables in database

Are the fields always the same in all the tables ?
Are there forms build to see data from any table ?
I can't believe that with a list like that you spend every month hours to change all the links of forms to the new table...

Why not just import the data in the same table and add a field "Id_Year" where you store "January_2014" then just filter on the most recent one every month...
Grumm is offline   Reply With Quote
Old 02-15-2016, 05:07 AM   #3
jdraw
Super Moderator
 
jdraw's Avatar
 
Join Date: Jan 2006
Location: Ottawa, Ontario, Canada;West Palm Beach, Florida
Posts: 12,238
Thanks: 93
Thanked 2,026 Times in 1,973 Posts
jdraw is a glorious beacon of light jdraw is a glorious beacon of light jdraw is a glorious beacon of light jdraw is a glorious beacon of light jdraw is a glorious beacon of light
Re: VBA union all tables in database

I agree with Grumm -- why not design a table and import.
Union queries are not updateable, if that is a concern.

__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
jdraw is offline   Reply With Quote
Reply

Tags
loop , procedure , union all , vba

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Query Union tables Ciprian Queries 1 09-15-2011 03:17 AM
UNION two tables with same primary key values carillonator Queries 5 02-02-2010 12:34 PM
Union Query - Maximum tables mbentley Queries 3 12-18-2004 07:40 PM
How do I avoid the union query sucking up the individuality of my tables CarlaKingery Queries 3 06-03-2002 09:08 AM




All times are GMT -8. The time now is 01:18 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World