Results 1 to 6 of 6
  1. #1
    bpen91 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2011
    Posts
    3

    Adding records into multiple tables at a single moment

    Hello guys! I'm an ms access newbie here and have a question to ask..

    Scenario:

    Supposing you have 4 Tables
    1.)User


    2.)Admin
    3.)Teacher
    4.)Pupil

    Now the "User" table has the ff. fields: ID(auto num),FName,MName,LName,User,Pass,Type.

    Now what I want to do is, if I add a new a record in the table "User" and if the record has the data "Admin" in the field "Type" then the record should also be saved in the table "Admin" but if the data is "Teacher" or "Pupil" then it should be also saved in their respective tables.

    Question is: Is that possible? If yes, then how??

    Sorry guys for the trouble and thanks for the help!

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Why do you have 3 tables for people? Are the fields of these tables significantly different?

    You might be able to do a form/subform arrangement. No code would be required. Just don't have enough info about your data structure. Otherwise VBA code will be need to run an sql INSERT statement to save record to appropriate table.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    bpen91 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2011
    Posts
    3
    Because the admin,pupil and teacher tables will also contain different fields(for ex. section, batch for table Pupil) and will be related to other tables(for ex. Results) and our teacher don't want us to create a user and pass field for every table.

    Is there another way to approach this problem??

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Post diagram of data schema for analysis. Or the project itself.

    Regardless of your data arrangement, the choices are basically what I already offered.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    bpen91 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2011
    Posts
    3
    Here's the complete design:
    "User" table has ID(auto num),FName,MName,LName,User,Pass,Type.

    "Admin and Teacher" table has ID,FName,MName,LName,Gender

    "Pupil" table has ID,FName,MName,LName,Gender,Batch,Section.

    Now this "Pupil" table will be used for the "Results" table too.

    Our teacher told us not to put "Username" and "Password" fields for each table so that's why I decided to use another table "User" for the username and pass.

    I don't know how will I do it with the Relationship since the "Type" should be determined first before adding the record into the other table.

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    So users can be Admins and Teachers and Pupils? You should not save names in all tables. Names should not be the primary/foreign keys. Still don't understand why three tables for people. I suggest one table for all people with basic info and child tables for specialized data. Consider this:

    Users
    ID (primary key)
    FName
    MName
    LName
    UserName
    Password
    Type (what is this - Pupil, Admin, Teacher?)
    Gender

    PupilResults
    UserID (foreign key)
    Batch
    Section
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Create Multiple Records from Single Form
    By mcktigger in forum Forms
    Replies: 17
    Last Post: 09-15-2011, 11:07 AM
  2. Creating multiple records from a single form
    By secretary in forum Forms
    Replies: 8
    Last Post: 07-18-2011, 04:03 PM
  3. Multiple records on a single page
    By neo651 in forum Forms
    Replies: 1
    Last Post: 06-29-2011, 10:21 PM
  4. Replies: 8
    Last Post: 01-21-2011, 10:28 AM
  5. Table related to multiple tables by single ID
    By MrTumnus in forum Access
    Replies: 1
    Last Post: 11-17-2009, 02:05 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums