Results 1 to 9 of 9
  1. #1
    ozzy is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2014
    Posts
    8

    calculation to a subform from two dynamic subform


    Hello,
    I am quite new in access so forgive me if i dont use proper terminology.
    As you can see in the photo i made three subform first two of them are linked to comboboxes, with which you can choose product and the details of product show up in the subforum below.

    My aim is to show the difference between some of product details (numerical ones) on the third form. (well maybe they all must be query :S )
    Anyway, i dont know how to get data from first two subform and to make the calculation in the third subform since the first two subform are changable depending on the product chosen.

    thank you very much...

    Ozzy
    Click image for larger version. 

Name:	1.JPG 
Views:	15 
Size:	86.1 KB 
ID:	16479

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    In each text box you can use the 'BUILDER' to pick form existing forms..
    It may end up looking something like: txtBox3.ControlSource = Me.[Child1].Form![txtWidth]- Me.[Child2].Form![txtWidth]

    the main form (me)
    [child1] is the object name of the sub-form.
    and inside that subform (.FORM)
    is the txtbox (txtWidth)

  3. #3
    ozzy is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2014
    Posts
    8
    Hi Ranman,
    Thank you for your immediate reply.
    I tried a couple of version but couldnt make it, here i attached a bit more detail, would be so nice if you can have a look.
    this is only i can come up with :
    =[Width].[ControlSource]=[FrmComparisionDiff].[FormComparisionPage1]![Width]-[FrmComparisionDiff].[FormComparisionPage2]![Width]
    I put this in 'property sheet' at 'control source' section of the textbox.
    Click image for larger version. 

Name:	t.JPG 
Views:	9 
Size:	230.7 KB 
ID:	16486

    form name: FrmComparisionDiff
    Subform Names; frmComparisionPage1, 2, 3
    Text box names all are Width

    I Dont know if its necessery to know but FrmComparisionDiff works under a navigation form called Form_SubMain
    Click image for larger version. 

Name:	1t.JPG 
Views:	7 
Size:	94.8 KB 
ID:	16488

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    The left part (=[Width].[ControlSource]) should be excluded from expression.

    =[FrmComparisionDiff].[FormComparisionPage1]![Width]-[FrmComparisionDiff].[FormComparisionPage2]![Width]
    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
    ozzy is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2014
    Posts
    8
    Hey June, thanks, i did, but doesnt work,
    can it be because of combo boxes? because subforms are empty till i pick one of product from comboboxes.
    may be i should put a button to update third subform or an event like afterupdate??

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    The expression should automatically refresh when the forms populate.

    What is the exact error now?

    You said this is on a navigation form but the image does not look like navigation form.

    If you want to provide db for analysis, follow instructions at bottom of my post.
    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.

  7. #7
    ozzy is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2014
    Posts
    8
    just cancel login window and open FrmComparisionDiff

    the path Main_Panel> click "Product" (From_Submain) > click "Comparision" (FrmComparisionDiff)
    Attached Files Attached Files

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Are you aware of the misspelling of Comparison in the form names?

    The expression should reference name of the subform container control, not the form it holds.

    The following does not show error but also does not show calc until I click Refresh from the ribbon.

    =[Parent].[ReportFormComparision1]![Width]-[Parent].[ReportFormComparision2]![Width]

    So I was wrong about the automatic calc of the subform and therefore include code in combobox AfterUpdate event to refresh the subform.
    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.

  9. #9
    ozzy is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2014
    Posts
    8
    Thanx for all

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

Similar Threads

  1. Subform Footer Calculation
    By bsc0617 in forum Forms
    Replies: 21
    Last Post: 08-29-2013, 02:28 PM
  2. Replies: 6
    Last Post: 05-05-2012, 08:43 AM
  3. subform calculation.
    By chivo123 in forum Access
    Replies: 11
    Last Post: 01-30-2012, 11:32 AM
  4. Subform with dynamic number of columns
    By modbass in forum Programming
    Replies: 1
    Last Post: 12-15-2011, 03:39 AM
  5. Subform vs main form calculation
    By fadone in forum Forms
    Replies: 17
    Last Post: 12-21-2005, 07:27 AM

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