Insert data into 6 different tables

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Hi5

    Insert data into 6 different tables

    Hi,

    Any Idea how, I can make an Insert statement to insert data into 6
    different tables, that are all holding all data of my database?

    Is there any example?

    I would be grateful if you could let me know of the ways to view data
    in a query and then add data to database

    Many thanks

  • lylefair@yahoo.ca

    #2
    Re: Insert data into 6 different tables

    Helpful answers require one or more of the following:

    1. A Clear and Complete Question with background sufficient that we
    have a clue about what you are talking;
    2. A Lucky Guess;
    3. A Responder who is at the same stage of bewilderment as the poster.

    The third may not lead to long term gain.

    Comment

    • Hi5

      #3
      Re: Insert data into 6 different tables

      Well Here is the my data tables:
      1-Client
      2-CChar
      3-Category
      4-Desc
      5-Info
      6-Other info (Optional)

      relation ships are as follows:
      Client 1 to many Ccahr
      CLIENT 1 to many info
      Info many to 1 to Desc
      Cchar 1to many to Info
      Cchar many to 1 to category

      Now I sopuse the info is more or less soficient!!

      Could you plaese help ma?

      Many Thanks

      Access newbie

      Comment

      • Bas Cost Budde

        #4
        Re: Insert data into 6 different tables

        Hi5 wrote:
        [color=blue]
        > Hi,
        >
        > Any Idea how, I can make an Insert statement to insert data into 6
        > different tables, that are all holding all data of my database?[/color]

        An INSERT statement will insert into just one table, in the reach of my
        knowledge.
        If the table structure is the same, you made a design error that must be
        corrected.

        --
        Bas Cost Budde, Holland

        Comment

        • Tim Marshall

          #5
          Re: Insert data into 6 different tables

          Hi5 wrote:
          [color=blue]
          > Any Idea how, I can make an Insert statement to insert data into 6
          > different tables, that are all holding all data of my database?[/color]

          No, an insert statement has a structure such that you insert into ONE table.

          You will need six separate statements with criteria to make sure that
          you get six separate sets of data.

          However, if these six tables have the same data structure, it would be
          silly in the extreme to have six separate tables.
          --
          Tim http://www.ucs.mun.ca/~tmarshal/
          ^o<
          /#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
          /^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me

          Comment

          • Hi5

            #6
            Re: Insert data into 6 different tables

            Hi,
            Many thanks for your answer, Of course the datasets are different.
            we have the Primary and foriegn keys that are numbers and are the same
            in all realated tables,to make it simple I.E.
            I need to input client from a dropdown and category from a text box in
            one go is there any way of doing that?
            many thanks

            Comment

            • lylefair@yahoo.ca

              #7
              Re: Insert data into 6 different tables

              I cannot think of a way to update or insert into multiple tables
              related as many to one.
              Typically in Access we use a forms and subforms to edit sych a
              relation. I don't use subforms per se, but I believe that six is more
              than the Access limit.
              Regardless, SQL Insert Statements are very efficient, and running off
              six in succession should be almost instantaneous.

              Comment

              • Tim Marshall

                #8
                Re: Insert data into 6 different tables

                Hi5 wrote:[color=blue]
                > Hi,
                > Many thanks for your answer, Of course the datasets are different.
                > we have the Primary and foriegn keys that are numbers and are the same
                > in all realated tables,to make it simple I.E.
                > I need to input client from a dropdown and category from a text box in
                > one go is there any way of doing that?
                > many thanks[/color]

                Are you talking here about inputting the client that is chosen from the
                drop down - "combo box" in Access - and whatever is in the text box into
                a table, as a a single record?

                Or, does the client from the combo box tell you what table the text box
                needs to made a record of?

                Or, will the client choice in the combo box specify what records from
                another table need to be inserted into a specific table?

                The way to do this is in code, associated with a command button, that
                writes the SQL statement you need and the executes it. You can figure
                out how to write the SQL statement by setting one up on the Access query
                design window and then switching to SQL View (Click View->SQL View).
                Copy the SQL and break it up to put in values from the text box and the
                combo box in the appropriate places.

                If you're not sure how to write the code, respond back with an answer on
                the questions I make above and I'll try to show you how to do this -
                enough at least, to set you on your way! 8)
                --
                Tim http://www.ucs.mun.ca/~tmarshal/
                ^o<
                /#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
                /^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me

                Comment

                • David W. Fenton

                  #9
                  Re: Insert data into 6 different tables

                  "lylefair@yahoo .ca" <lylefair@yahoo .ca> wrote in
                  news:1119015655 .633907.72650@f 14g2000cwb.goog legroups.com:
                  [color=blue]
                  > I cannot think of a way to update or insert into multiple tables
                  > related as many to one.
                  > Typically in Access we use a forms and subforms to edit sych a
                  > relation. I don't use subforms per se, but I believe that six is
                  > more than the Access limit.
                  > Regardless, SQL Insert Statements are very efficient, and running
                  > off six in succession should be almost instantaneous.[/color]

                  And likely should be wrapped in a transaction.

                  --
                  David W. Fenton http://www.bway.net/~dfenton
                  dfenton at bway dot net http://www.bway.net/~dfassoc

                  Comment

                  • Hi5

                    #10
                    Re: Insert data into 6 different tables

                    Hi,
                    Yes some data is to be selected from drop down and some fields are to
                    be filled by typing the data in.
                    That's very kind if you can show me how to code both of them
                    many thankls

                    Comment

                    Working...