Results 1 to 4 of 4
  1. #1
    bornfattom23 is offline Novice
    Windows XP Access 2003
    Join Date
    Nov 2010
    Posts
    5

    Need to have subform field prepopulate with data from main form field

    Hey folks,
    I've created a database to track our Financial Aid payments at our school. I have a form in which staff can enter a student's info, including start date. This form contains a subform in which staff enter the payments from FA that we are anticipating for the student. The student info is stored in a table called Students, and the payment info in a table called Payments.

    Each payment is keyed to a specific payment date, which is always the same as the student's start date (at least within the scale we're working with). Currently, staff have to enter the date for each payment manually. Since the payment date is nearly always the start date, I want the payment date to prepopulate with the date the staff member entered into the "Start Date" Field, as each new payment record is created.

    Sooooooo, any ideas? Thanks a million for any help you can provide.

  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,521
    Try a default value in that textbox of:

    Forms!FormName.StartDate

    or whatever the actual names are. It may need an = at the beginning.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    bornfattom23 is offline Novice
    Windows XP Access 2003
    Join Date
    Nov 2010
    Posts
    5
    That's a good start (it mostly works). There are just two issues with that approach.

    1. The first record in the Payments subform does not prepopulate (all entries after that do)

    2. This creates an unsightly error when I use the same payments subform in a different form that doesn't contain the [New Student].[Start Date] control. The new entry space after the last entry in the Payments subform displays #Name? I literally mean unsightly, as it doesn't seem to affect the function of the form, just makes it look like I don't know what I'm doing (although it's pretty clear I don't).

    Thanks a million for the help.

  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,521
    See if this untested air-code works in the current event of the subform:

    Code:
    If Me.Parent.Name = "New Student" Then
      Me.DateFieldName = Me.Parent.[Start Date]
    End If
    If it works but still leaves the first record blank, try it in the got focus event of the textbox in the subform. That would make it populate as the user enters the textbox.

    By the way, the spaces in your names are not worth the bother in the long run.
    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. Update field in subform from field in Main
    By jpkeller55 in forum Access
    Replies: 9
    Last Post: 10-15-2010, 03:37 PM
  2. Replies: 2
    Last Post: 06-17-2010, 04:15 PM
  3. Replies: 1
    Last Post: 06-14-2010, 02:31 AM
  4. Replies: 4
    Last Post: 05-17-2010, 05:32 PM
  5. Replies: 2
    Last Post: 03-31-2010, 01:56 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