Results 1 to 3 of 3
  1. #1
    EvanRosenlieb is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2011
    Location
    Fort Collins, CO
    Posts
    37

    Autopopulation using macros?

    I wasn't sure whether to post this under macros or forms as I believe it covers both...

    I am building a database for an academic research project and am rather new to access. The specific part of the database I'm working on now deals with data that is being collected from soil samples from multiple sites across multiple times and includes two tables, a Samples table and a Cores table. The Samples table has information about the the site the sample come from and the date that it is sampled and processed. The Cores datasheet has data (Ph, moisture content, etc) about each of the six individual cores that is collected from each site. They are connected by a parent child relationship where, of course, Samples is the parent and Cores the child.

    What I want to be able to do is have a form (or a collection of forms) that does the following:

    1) Asks for the information about the sample (Site and Date collected)

    2) Automatically creates six records in the Core datasheet with the SampleID of the Sample that was just created



    3) Then pops up a second form in which that data for each of the cores can be entered.

    I know how to create a simple macro that will go to another form when the current one is done. What I really want to know how to do is create six new records in the child table. Is this doable? Is there some other design that would work better?

    Any help is greatly appreciated

    -Evan

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    I think will require VBA code to save the six records. I don't use macros but don't think can do this with one. Are you positive there will always be 6 cores? What if one is lost or damaged? Do a form/subform arrangement. As user enters each core in the subform, record is created. No code required.
    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
    EvanRosenlieb is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2011
    Location
    Fort Collins, CO
    Posts
    37
    Do a form/subform arrangement. As user enters each core in the subform, record is created. No code required.
    Thanks I have used this approach and am having much more success with it. I have it almost all figured out however I am having one problem. The data that gets entered in the parent form shows up as a record on the parent table, and the information that gets entered into the subform gets entered as new records in the child table. However the ParentID field in the child table remains blank. I would like the ParentID field to automatically add the ParentID of the record that is being added into the child table... Surely there is a way to do this?
    Thanks,
    -Evan

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

Similar Threads

  1. Macros
    By Capri Pruitt in forum Access
    Replies: 1
    Last Post: 09-13-2010, 10:36 PM
  2. vba vs macros
    By RedGoneWILD in forum Access
    Replies: 4
    Last Post: 08-06-2010, 12:48 AM
  3. VBA vs Macros
    By Evgeny in forum Programming
    Replies: 3
    Last Post: 05-11-2010, 02:15 PM
  4. VBA or Macros
    By mastromb in forum Forms
    Replies: 6
    Last Post: 01-03-2010, 04:46 PM
  5. Macros
    By kfhai in forum Access
    Replies: 0
    Last Post: 04-17-2009, 08:28 AM

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