Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2004
    Posts
    12

    Unanswered: How to get data from one table to another

    HI,
    I am writing a database to manage my drink machines.

    I have 3 tables.

    The first table contains a list of the different drinks. (coke, pepsi etc).

    The second table contains the machine number and the different drinks it sells. Usually only 3 different types. So it has MachineID (Primary Key), Drink1, Drink2 and Drink3. The Drink1,2 and 3 are refenced to the drink types via a lookup table.

    The third table is the one which records the sales.

    What I want to happen is to write a form which collects the drink types from Table 2 and puts them into Table 3 automatically so I just have to enter the number of drinks sold.

    However, when I try to construct the form, I always have to use the drop down box to select the types of drinks in the each machine.

    Any assistace would be greatly appreciated. Please make your advice in simple speak as I am a rank beginner.

    Regards
    Jeff

  2. #2
    Join Date
    Sep 2003
    Location
    The extremely Royal borough of Kensington, London
    Posts
    778
    Table1(drink_id) Primary Key (drink_id)
    Table2(machine_id, drink_id) Primary Key (machine_id, drink_id)

    insert into table3 (drink_id) select distinct drink_id from table2
    Bessie Braddock: Winston, you are drunk!
    Churchill: And Madam, you are ugly. And tomorrow, I'll be sober, and you will still be ugly.

  3. #3
    Join Date
    Mar 2004
    Posts
    12
    Hi Guru,
    Thanks for your post. I don't quite follow your intsructions though. Can you please post directions on how to acomplish this through the design view or just expand on what I have to do with this string:

    insert into table3 (drink_id) select distinct drink_id from table2


    Regards

    Jeff

  4. #4
    Join Date
    Mar 2004
    Posts
    12
    Someone please help in my question above.

    Also, if anyone could direct me to a good internet based source for Access tutorial type information it would be much appreciated.

    Thanks in advance.

    Jeff

  5. #5
    Join Date
    Sep 2003
    Location
    The extremely Royal borough of Kensington, London
    Posts
    778
    Query=>Design View=>SQL View
    Bessie Braddock: Winston, you are drunk!
    Churchill: And Madam, you are ugly. And tomorrow, I'll be sober, and you will still be ugly.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •