Hello again:
I am doing a parameter query of an Access table that we can call Master. At an unpredictable time during each month, a monthly table, called mmmyyModComp, is deposited in the Access. I need to be able to detect when it is there and have it appended to the Master table before I issue the parameter query. I could accomplish the same thing with a union query using Msquery but the EXCEL97 version will not allow the use of parameters with a Union query. So, I would need to be able to save the result of the union query and then run the parameter query against it. I do not know how to do this using MSQUERY or DAO. Can any one give me a clue?
Currently, I am manually appending the monthly table to the Master in ACCESS. I would like to be able to get out of the loop and completely hand over the programs to the people who want to use them.
Thanks
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
Appending Access tables prior to a parameterQuery (OFFICE 97 SR2)
Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Appending Access tables prior to a parameterQuery (OFFICE 97 SR2)
- This topic has 5 replies, 4 voices, and was last updated 23 years, 3 months ago.
AuthorTopicWSepic60sman
AskWoody LoungerMarch 6, 2002 at 9:05 pm #367841Viewing 0 reply threadsAuthorReplies-
WSralphad
AskWoody LoungerMarch 7, 2002 at 9:00 am #574871How is this access database used? Do you have a client application which you built which is the sole entry point, or are there other ways that people use the data? If the former, you could build something into your application which looks for the mmmyyModComp table when it initialises, then appends the table’s data to Master, before deleting the mmmyyModComp table or renaming it for archiving. If there are other ways that people use the data, then I’d say you need an application running somewhere which polls the database for the appearance of the file, and then does the appending, etc. This kind of application would have to be running on a server somewhere, if you have access to such resources.
Regards,
-
WSepic60sman
AskWoody LoungerMarch 7, 2002 at 2:53 pm #574915You asked: “Do you have a client application which you built which is the sole entry point”. Answer: YES
You commented: “you could build something into your application which looks for the mmmyyModComp table when it initialises, then appends the table’s data to Master, before deleting the mmmyyModComp table or renaming it for archiving.”
Yes, this is exactly what I need.
My idea was to use a union query to append the 2 tables. However, my application consists of a parameter query that is launched out of EXCEL97 and MSQUERY (or DAO) will not allow use of parameters with a union query. My next idea was to use the union query to append the tables and the parameter query to get the data from the appended table but I do not know how to do this. I tried saving the EXCEL query and then using the parameter query to get data from it but found that this was not possible. Is there some way that the EXCEL query can save the appended table in ACCESS?
Basically, I understand what I need to do but I don’t know how to do it.
Thanks for your help -
WSrory
AskWoody LoungerMarch 7, 2002 at 5:21 pm #574957Hi,
You can certainly do this with DAO. You would code your Excel spreadsheet to open the database, check the Tabledefs collection for the relevant tablename, if there, run an append query. You then have the option of either using your existing Excel query or simply opening a recordset since you have the database open anyway. Then you need to delete the table and close the database.
You could equally run the whole thing from Access, automating Excel and copying the relevant recordset into it. Just depends on whether your users are comfortable using Access or want to do it all through Excel!
Hope that helps. -
WSdcardno
AskWoody LoungerMarch 7, 2002 at 11:17 pm #575013The other alternative is to design a union query in Access that does the union you want, then a make-table query in Access that just takes the union query you just wrote in the query grid and the “*” for all fields and creates a new table – call this table “NewTable” and the query qryMkNewTable. You have to do this two-step approach since you can’t write a “Union Make Table” query (or maybe YOU can – I can’t ).
In Excel you open the querydefs collection and execute qryMkNewTable, and then run the parameter query against NewTable
-
WSralphad
AskWoody LoungerMarch 12, 2002 at 8:36 pm #575887I’d say your excel sheet should stay just as it is, for simplicity, with just the addition of a bit if VBA in an AutoOpen() routine, which uses DAO, as Rory suggests, to run the append query which will append the contents of mmmyyModComp to the Master table.
Something like this should do the trick, placed in a module in your Workbook (the Workbook will have to be referenced to DAO – please ask if you don’t know how to do this):-
Sub AutoOpen() Dim db As Database Dim tbl As TableDef Dim sTablename As String 'open the database Set db = OpenDatabase("c:mydatabase.mdb") 'loop thru the tabledefs to see if this month's table is there sTablename = Format(Date, "mmmyy") & "ModComp" For Each tbl In db.TableDefs If tbl.Name = sTablename Then 'rename the monthly table to the name that the append query is looking for db.TableDefs(sTablename).Name = "ModComp" 'run the append query db.QueryDefs("myAppendQuery").Execute 'rename the table back to the monthly name, _ with a suffix indicating it has been appended to Master db.TableDefs("ModComp").Name = sTablename & "_appended" 'exit the loop thru the tables Exit For End If Next tbl 'close the database db.Close 'garbage collection Set tbl = Nothing Set db = Nothing End Sub
-
-
-
Viewing 0 reply threads -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Microsoft : Edge is better than Chrome
by
Alex5723
11 hours, 42 minutes ago -
The EU launched DNS4EU
by
Alex5723
1 day ago -
Cell Phone vs. Traditional Touchtone Phone over POTS
by
280park
14 hours, 44 minutes ago -
Lost access to all my networked drives (shares) listed in My Computer
by
lwerman
1 day, 5 hours ago -
Set default size for pasted photo to word
by
Cyn
1 day, 11 hours ago -
Dedoimedo tries 24H2…
by
Cybertooth
23 hours, 58 minutes ago -
Windows 11 Insider Preview build 27871 released to Canary
by
joep517
2 days, 10 hours ago -
Windows 11 ad from Campaign Manager in Windows 10
by
Jim McKenna
3 hours, 36 minutes ago -
Small desktops
by
Susan Bradley
2 hours, 42 minutes ago -
Totally disable Bitlocker
by
CWBillow
1 day, 4 hours ago -
Phishers extract Millions from HMRC accounts..
by
Microfix
2 days, 8 hours ago -
Windows 10 22H2 Update today (5 June) says up-to-date but last was 2025-04
by
Alan_uk
3 days, 14 hours ago -
Thoughts on Malwarebytes Scam Guard for Mobile?
by
opti1
1 day, 9 hours ago -
Mystical Desktop
by
CWBillow
3 days, 18 hours ago -
Meta and Yandex secretly tracked billions of Android users
by
Alex5723
2 days, 23 hours ago -
MS-DEFCON 2: Do you need that update?
by
Susan Bradley
10 hours, 41 minutes ago -
CD/DVD drive is no longer recognized
by
WSCape Sand
4 days, 9 hours ago -
Windows 11 24H2 Default Apps stuck on Edge and Adobe Photoshop
by
MikeBravo
4 days, 12 hours ago -
North Face and Cartier customer data stolen in cyber attacks
by
Alex5723
4 days, 10 hours ago -
What is wrong with simple approach?
by
WSSpoke36
2 days, 8 hours ago -
Microsoft-Backed Builder.ai Set for Bankruptcy After Cash Seized
by
Alex5723
4 days, 21 hours ago -
Location, location, location
by
Susan Bradley
3 days, 12 hours ago -
Cannot get a task to run a restore point
by
CWBillow
4 days, 23 hours ago -
Frustrating search behavior with Outlook
by
MrJimPhelps
4 days, 13 hours ago -
June 2025 Office non-Security Updates
by
PKCano
5 days, 9 hours ago -
Secure Boot Update Fails after KB5058405 Installed
by
SteveIT
12 hours, 12 minutes ago -
Firefox Red Panda Fun Stuff
by
Lars220
5 days, 9 hours ago -
How start headers and page numbers on page 3?
by
Davidhs
5 days, 20 hours ago -
Attack on LexisNexis Risk Solutions exposes data on 300k +
by
Nibbled To Death By Ducks
4 days, 22 hours ago -
Windows 11 Insider Preview build 26200.5622 released to DEV
by
joep517
6 days, 4 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.