Results 1 to 6 of 6
  1. #1
    Seven is offline Novice
    Windows XP Access 2003
    Join Date
    Dec 2009
    Posts
    8

    new record is subform

    sorry if too much info, but too much is better than too little i hope


    my application is a work / time tracker

    main problem table->follow up item table->work history table
    any number of main tables
    each main table has many follow up items
    each follow up item has many work history's

    ProblemRecord
    ----research something
    ----------I researched - took 3 hours
    ----------I researched more- took 2 hours
    ----------I researched more- took 3 hours
    ----go do somethng
    ----------I did something - took 3 hours
    ----------I did something else- took 4 hours
    ----go do something else


    To aloow the assocaites to input data, I have a main form with 2 subforms.

    when the user selects a button like "Create Work Order" I need to auto generate the main form and mulstiple records in the subforms.

    example when pressed :
    open the main form
    ...put some generic data into the main form like todays date
    create multiple records in the subform
    ...put some generic data into the subform record

    something like this when button pressed : auto generate

    ProblemRecord
    ----begin job record
    ----------I began the work record - took 0.5 hours
    ----do step 1 of our procedure
    ----do step 2 of our procedure
    ----Review with management
    ----do step 4 of our procedure


    I have most of this working.
    i can generate the work order
    I can generate the first subform record

    my question :

    in the code module, how do I generate the 2nd, 3rd and 4th subrecords and access them to put some data into them?



    any help is appreciated.
    Seven

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I'm being thrown off by your terminology.
    "auto generate the main form and mulstiple records in the subforms" is to me a strange way to describe Access.
    "how do I generate the 2nd, 3rd and 4th subrecords" is also confusing. What do you mean by the term "generate" in these two expressions?

  3. #3
    Seven is offline Novice
    Windows XP Access 2003
    Join Date
    Dec 2009
    Posts
    8
    sorry for the confusion, i am a beginner at this...

    I created a table called MAIN
    I then created a table called sub1 that has a field that links to MAIN id

    I then created a form that contain the MAIN record, and it also has a subform showing the sub1 records that are linked to the MAIN. the user can move through the sub1 records while the MAIN stays, or they can move through the MAIN (which of ourse changes the sub1)

    when the user hits a button on a generic user form, i want the user to be taken to the MAIN form, a new MAIN record created, and then some new records in the sub1 table also, which are linked to the new MAIN.

    so it looks like this.
    click button, create new MAIN record, create 3 sub records that are linked to the MAIN and put values in the sub1 record fields.

    again, any help is greatly appreciated!
    Seven

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Why are you automatically creating records for the SubForm?

  5. #5
    Seven is offline Novice
    Windows XP Access 2003
    Join Date
    Dec 2009
    Posts
    8
    it is a time tracking database, and when the associate creates a specific type of job record, i need to automatically create 3 or 4 follow up items that he must do.

    Code:
        stDocName = "Zone 2 Work History Data Entry Form"
        DoCmd.OpenForm stDocName, , , stLinkCriteria
        DoCmd.GoToRecord , , acNewRec
        Forms("Zone 2 Work History Data Entry Form").[PTC Item Title] = "this is a test"

    this generates the main form for me and puts some test string in on eof the fields.... but how do i generate a new sub1 form that is linked to the main and then put some text in one of it;s fields?

    for example :

    do this first
    do this second
    review with me
    go do something else

    and then he can select the MAIN record, scroll throught he sub1 records until he finds the one he did, and then he can put in his time on the sub2 record. this allows me to roll up all of the time spent on each follow up item, and continue adding up the time spent on each MAIN project.

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I am not a big fan of running one form from another as you are doing. Following the logic and maintaining the system years later can be a problem. You can use the OpenArgs argument to pass information to the next form and then test it in the OnLoad event of the next form and do whatever you want. Then the form will stand on its own and be easier to maintain later.

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

Similar Threads

  1. Replies: 0
    Last Post: 09-01-2009, 12:33 PM
  2. Subform add new record
    By ricardo9211 in forum Forms
    Replies: 0
    Last Post: 08-26-2009, 12:01 AM
  3. Replies: 0
    Last Post: 01-06-2009, 02:17 PM
  4. Replies: 4
    Last Post: 10-29-2008, 11:53 AM
  5. Can I edit a record with a subform?
    By bigmax in forum Forms
    Replies: 0
    Last Post: 08-11-2008, 07:55 AM

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