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 
Insert records to tables
Mario Jaile 
    
3 years ago
I need to add records from a query/form to 2 tables
Scott Axton  @Reply  
        
3 years ago
Mario Jaile OP  @Reply  
    
3 years ago
I need to at the same time add to 2 tables, append only allows to 1 table
Kevin Robertson  @Reply  
          
3 years ago
Build 2 Append Queries and use either a Macro or VBA code to run them both.
Mario Jaile OP  @Reply  
    
3 years ago
I tried the 2 append queries, problem is that there is a one to many relationship in the 2 tables, when I append the "One" table, the record that correspond to the "Many" table disappears
Kevin Yip  @Reply  
     
3 years ago
When you add a record to the "one" table, there isn't any child record for that entry, so that's why you don't see anything in the "many" table.  That seems like a normal phenomenon.  For instance, on an order form with an order detail subform, if I enter a new order (new record on the "one" side), the subform will be empty because there isn't any order detail yet (no record on the "many" side yet).
Mario Jaile OP  @Reply  
    
3 years ago
Thanks. So how do I fill the the record that I have in the "Many" query which is the subform to the "One"?.
Kevin Yip  @Reply  
     
3 years ago
As others have said, you just run another append query to add records to the "many" side.  All primary key fields on the "many" side need to be part of the append, since they don't add themselves.  The appended data need to be actually related to the record on the "one" side, of course.  If the "one" side's ID field is 1, and the appended data to the "many" side also need to have the related ID value of 1.
Mario Jaile OP  @Reply  
    
3 years ago
The record in the "many" side with the same ID as in the "one" side disappears from the many side once I append the records from the "one" side.
Kevin Yip  @Reply  
     
3 years ago
It disappears because the "many" side has no records related to the "one" side record you just added.  Every record you add to the "one" side is a DIFFERENT record -- that's why it's called the "one".  There can only be one record on the "one" side that can relate to a specific set of child records on the "many" side.
Mario Jaile OP  @Reply  
    
3 years ago
I found out why it was disappearing, the query that I use to append to tables had a <=Date()-30, so every time I append the "one" with today's date,  it would be gone from the query, so if I don't append the date it works, now the problem is inserting today's date to the record in the "One" table.
I tried through VBA [tblOne]![OrderDate=Date but it does not work.

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: 6/16/2026 2:56:27 PM. PLT: 0s