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
![]() |
There are isolated problems with current patches, but they are well-known and documented on this site. |
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, 2 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
-
Just got this pop-up page while browsing
by
Alex5723
23 minutes ago -
KB5058379 / KB 5061768 Failures
by
crown
8 hours, 39 minutes ago -
Windows 10 23H2 Good to Update to ?
by
jkitc
11 hours, 18 minutes ago -
At last – installation of 24H2
by
Botswana12
12 hours, 2 minutes ago -
MS-DEFCON 4: As good as it gets
by
Susan Bradley
1 hour, 40 minutes ago -
RyTuneX optimize Windows 10/11 tool
by
Alex5723
1 day ago -
Can I just update from Win11 22H2 to 23H2?
by
Dave Easley
17 hours, 34 minutes ago -
Limited account permission error related to Windows Update
by
gtd12345
1 day, 13 hours ago -
Another test post
by
gtd12345
1 day, 13 hours ago -
Connect to someone else computer
by
wadeer
1 day, 8 hours ago -
Limit on User names?
by
CWBillow
1 day, 11 hours ago -
Choose the right apps for traveling
by
Peter Deegan
1 day, 1 hour ago -
BitLocker rears its head
by
Susan Bradley
9 hours, 15 minutes ago -
Who are you? (2025 edition)
by
Will Fastie
8 hours, 12 minutes ago -
AskWoody at the computer museum, round two
by
Will Fastie
1 day, 3 hours ago -
A smarter, simpler Firefox address bar
by
Alex5723
2 days ago -
Woody
by
Scott
2 days, 9 hours ago -
24H2 has suppressed my favoured spider
by
Davidhs
8 hours, 51 minutes ago -
GeForce RTX 5060 in certain motherboards could experience blank screens
by
Alex5723
2 days, 23 hours ago -
MS Office 365 Home on MAC
by
MickIver
2 days, 17 hours ago -
Google’s Veo3 video generator. Before you ask: yes, everything is AI here
by
Alex5723
3 days, 13 hours ago -
Flash Drive Eject Error for Still In Use
by
J9438
8 hours, 36 minutes ago -
Windows 11 Insider Preview build 27863 released to Canary
by
joep517
4 days, 8 hours ago -
Windows 11 Insider Preview build 26120.4161 (24H2) released to BETA
by
joep517
4 days, 8 hours ago -
AI model turns to blackmail when engineers try to take it offline
by
Cybertooth
3 days, 12 hours ago -
Migrate off MS365 to Apple Products
by
dmt_3904
3 days, 13 hours ago -
Login screen icon
by
CWBillow
3 days, 3 hours ago -
AI coming to everything
by
Susan Bradley
18 hours, 4 minutes ago -
Mozilla : Pocket shuts down July 8, 2025, Fakespot shuts down on July 1, 2025
by
Alex5723
5 days ago -
No Screen TurnOff???
by
CWBillow
53 minutes 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.