How to insert a record set into multiple the parent table and child table in a one to many relation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • VeronicaNTAM
    New Member
    • Jul 2021
    • 1

    How to insert a record set into multiple the parent table and child table in a one to many relation

    Hi evryone,
    i am sure you have probably had this questions several times. I am new to Access, so please bear with me.
    i have data on an excel sheet imported into my access database. and this data needs to be inserted into two tables. The parent table is linked to the Child table with the help of a primary key in a one to many relation. i can insert the data i need into the Parent table but i get stuck at the second level , that is, the data which need to go into the child table does not do that.

    I am trying to SQL with the INSERT INTO, but i am not sure I am writing it correctly.
    Someone suggested using VBA to do this, but as I said, I am new.

    can any one help me out her. show me how to start?
    thanks alot
    Last edited by NeoPa; Jul 6 '21, 04:58 PM. Reason: "bare" to "bear" - we don't want to give the wrong impression.
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32661

    #2
    Hi Veronica.

    Welcome to Bytes.com.

    Please understand, no matter how much we'd like to help, telling you where you've gone wrong is always going to be difficult until you share what it is you're doing.

    When populating data into a Child table it is often first necessary to populate the Parent table. Have you done this successfully first? If not then you'll struggle but your post indicates that you probably have.

    What data are you working with? Example data is fine.

    What have you tried that isn't working? It's far easier to explain something that you can understand if we start with something you know. If you have some SQL that's close and just needs a small change that's so much easier for you to understand than writing it from scratch.

    From what you've written so far I assume you're working in SQL but using QueryDef (Saved Query) objects. That's fine but if not correct we absolutely need to know.

    Comment

    Working...