Results 1 to 5 of 5
  1. #1
    dipitiduda2 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jan 2014
    Posts
    28

    Find Last Record by Primary Key on Subform then Add New Record and Pass Thru Values

    Hello All: I'm an Access newbie so I might not use the correct terminology. I am trying to figure out how to add a new record and pass through values from the open subform to the new form - both subforms share the same recordset. I'm using the Record Selector to add a "New (blank) record". When the new record is open onscreen I want a value "End Balance" from the record I navigated from to be inserted into another textbox "Begin Balance" in the new record. And, I want the value "Calendar Year" from the record I navigated from to be iterated to the next year and inserted into the same textbox in the new record.

    Do I just use OpenArgs to pass the values through from the active record to the new record? If so, does anyone have a code example that I can follow?



    Any help is greatly appreciated!

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Where does this Balance value come from? Do you have transaction records that this is calculated from? Ideally, calculated data is not saved to table, especially aggregate data - calculate when needed.
    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
    dipitiduda2 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jan 2014
    Posts
    28
    Hi June7,

    Initially, the Begin and End Balance values will be data entered by the user on a subform. This will be the 1st row that exists for the ProgramID (PK in main table, FK in subtable). Thereafter, the BeginBalance of the 2nd subrecord has to be the same value as the EndBalance in the 1st subrecord.

    No, the Begin and End Balance fields are not calculated.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Okay, still no need to duplicate the Balance. Here is one method to retrieve the value of field from another record in same table http://allenbrowne.com/subquery-01.html#AnotherRecord

    However, if you must save, one approach may be to programmatically set the DefaultValue property of the BeginBalance control with the EndBalance value
    http://access.mvps.org/access/forms/frm0012.htm
    http://allenbrowne.com/ser-24.html
    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
    dipitiduda2 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jan 2014
    Posts
    28
    thank you very much...just needed a little guidance on how to proceed. Cheers!

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

Similar Threads

  1. Replies: 21
    Last Post: 07-04-2013, 10:46 AM
  2. Replies: 16
    Last Post: 02-06-2013, 03:06 PM
  3. Replies: 5
    Last Post: 08-24-2012, 10:32 AM
  4. Replies: 6
    Last Post: 08-22-2012, 03:24 AM
  5. Replies: 2
    Last Post: 03-25-2011, 12:22 PM

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