Results 1 to 6 of 6
  1. #1
    rachello89 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jan 2012
    Posts
    15

    Cool Add new records based on parameter value and Query

    I have two tables called Enrollments and Payments. Because of our recuring billing, each enrollment can have multiple payments. They have a one to many relationship.

    Is there a way that I can find all the records in the Enrollments table where the EndDate is null, and add a new payment record with a date that I can enter with a parameter value? So, if I have 5 enrollments that have an end date null value, then 5 new records would appear in the payments table each with the same date that I specify and all linked to their respective enrollments.



    If it is not possible, please suggust alternative methods. Thanks!

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    An append query:

    INSERT INTO Payments (Field1, Field2...)
    SELECT Field1, Field2...
    FROM Enrollments
    WHERE EndDate Is Null

    In your SELECT clause you can refer to a form to get the date value.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    rachello89 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jan 2012
    Posts
    15
    Thanks so much for your reply. I have never worked with append queries before, and I was wondering if you could be more specific in your directions. In Query design view, where do I need to enter the everything?

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Start a select query on the enrollments table, then switch it to an append query. It will ask for the destination table. Add the criteria and point to the form control for the date and you should be good to go.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    rachello89 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jan 2012
    Posts
    15
    Thanks for your help! It worked!

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Happy to help, and welcome to the site!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Counting records of a parameter query
    By JonathanT in forum Reports
    Replies: 5
    Last Post: 10-31-2011, 04:33 AM
  2. run parameter query based on option box selection
    By rivereridanus in forum Queries
    Replies: 1
    Last Post: 07-01-2011, 01:07 PM
  3. Replies: 0
    Last Post: 03-25-2011, 02:37 PM
  4. Replies: 1
    Last Post: 06-10-2010, 04:36 PM
  5. How to Add New Records based upon Query?
    By SteveAb in forum Database Design
    Replies: 0
    Last Post: 08-06-2009, 10:24 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