Results 1 to 8 of 8
  1. #1
    tareyj8569 is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Aug 2009
    Posts
    43

    Subform Calculated field to another subform

    Can you call a calculated unbound Subform from field from Subform 1 to another unbound Subform field in Subform 2?


    I have 1 mainform and 2 subforms
    I can get the field to show on my mainform from Subform 1but not my 2nd subform.

    =[overview subform].[Form]![Text103] < works on main form but not my 2nd subform

    =[Forms]![Overview mainform]![overview subform].[Form]![Text103] <does not work on my 2nd subform.

    Hope that wasn't too confusing, thanks for your time and help.

  2. #2
    InsuranceGuy is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Aug 2015
    Location
    Colorado
    Posts
    126
    It's a bit different once you're referring to subforms. Instead of referring to the subform by name, you should refer to the subform by the subform's control name on the main form.

    The appropriate reference pattern is:

    [Forms]![MainFormActualName]![SubFormControlName].Form.[ActualControlNameDesired]

    You'll note that I indicated SubFormControlName, not the subform's design name from the forms list. It's critical to referencing using the control name as defined on [MainFormActualName].

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    I always give subform/subreport container control a name different from the object it holds, like ctrSub1. Then reference the container control name.

    =[Forms]![Overview mainform].ctrSub1![Text103]
    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.

  4. #4
    InsuranceGuy is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Aug 2015
    Location
    Colorado
    Posts
    126
    Couldn't agree more June. Great best practice.

    Jeff

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Jeff, I did not see your post first - great minds ...
    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.

  6. #6
    tareyj8569 is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Aug 2009
    Posts
    43
    I don't know if I am doing something wrong or what but I keep getting 0 in my 2nd subform.

    Subform 1 shows 50%
    =Sum(IIf([Pass or Fail]="Pass" And [Location]="purple",1,0))/IIf(Sum(IIf([Location]="purple",1,0))=0,1,Sum(IIf([Location]="purple",1,0))) <this is my unbound calculated field

    Subform 2 shows 0%
    =[Forms]![Overview Mainform].[ABC_overview_subform]![text103] < put on unbound 2nd subform does not work
    =[Forms]![Overview mainform].ctrSub1![Text103] <was the example

    Mainform shows 50%
    =[ABC_overview_subform].Form!Text103 < on unbound mainform works

    If I am misunderstanding sorry.

  7. #7
    tareyj8569 is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Aug 2009
    Posts
    43
    tried to edit post but would not post, but wanted to add - also access automatically puts the brackets on the ABC_overview_subform when I leave them off.

  8. #8
    InsuranceGuy is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Aug 2015
    Location
    Colorado
    Posts
    126
    Do you want to attach your db?

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

Similar Threads

  1. Replies: 4
    Last Post: 09-24-2014, 09:11 AM
  2. Replies: 3
    Last Post: 04-04-2014, 07:14 AM
  3. Put calculated field on subform
    By TioAdjie in forum Forms
    Replies: 2
    Last Post: 02-23-2014, 09:43 PM
  4. Calculated Field on subform
    By nicole.skeeters in forum Forms
    Replies: 8
    Last Post: 07-23-2013, 05:55 PM
  5. Replies: 5
    Last Post: 11-16-2011, 07:30 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