Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
designing input query in SQL
Cearbhall O'Meadhra v 

11 years ago
In my new database, I have a table that shows agencies and gives their contact information.
I have another table that lists the possible addresses of premises that can be used by agencies.

Each Agency can occupy more than one address
Each address can accommodate a number of agencies
Therefore, I have a junction table that holds the primary keys of the Agency table and the addresses table as foreign keys, concatenated to make an exclusive key in the junction table.

I can write an append query that allows me to insert a new agency in the agencies table and a new address in the addresses table. I need an append query to copy the primary keys of the new record from the two tables into the junction table. The problem is that I cannot write to the junction table while I am running the append query that inserts the new records in the Agency and Address tables because their primary keys are autonum fields and do not appear until I close their append query. My problem then is, how to get the last primary key off each of the agency and address tables in a new query that appends them to the junction table.

I would have thought that this would be a very common procedure but I cannot find a single example! Can you help? Are there any examples of the complete append process for many to many tables?

There is a complication! I am visually impaired and use a screen reader. I cannot operate a form as it is unreadable to the screen reader. I can, however, work in MsSQL but that does not allow me to create or run a form.

I tried to view the video on concatenated keys but all I got was Richard's introduction to the lesson. I am completely stumped!


Reply from Alex Hedley:

Sounds like it is just a timing issue.
If you run your append query then close it.
You could use a DLAST (Expert 29) to get the Last Record inserted.
If you are using MSSQL you could use a TOP 1 to get the LAST Record.


If it is on a Form you could look at the .Dirty Property.
If you set that the AutoNumber will show then you can use it in your Append.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/16/2026 4:30:03 PM. PLT: 1s