Results 1 to 7 of 7
  1. #1
    sireesha is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Oct 2012
    Posts
    50

    Displaying Subform Totals in a Main Form in Microsoft Access but using master detail

    In the master form sale_id. depending on the sale_id collection records changed(in subform)(child form). 1 record,2 records or 0 records etc., when changing sale_id.



    so I want, In the subform i have a field collection_amt. i want to sum collection amt and shown in main form.

    i tried but whole collection amt is displayed. but i need only if saleid=8 collection amts like 334433,555,533 i need these sum only.
    those sum is shown in mainform,
    how
    please help me

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    The subform is in Continuous view? Expression in textbox: Sum(IIf(saleid=8,collection_amt,0))
    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
    sireesha is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Oct 2012
    Posts
    50

    Displaying Subform Totals in a Main Form in Microsoft Access but using master detail

    Quote Originally Posted by June7 View Post
    The subform is in Continuous view? Expression in textbox: Sum(IIf(saleid=8,collection_amt,0))

    The subform is in datasheet view. when changing saleid corresponding collection_amt s total displayed in mainform's textbox. how?

    Please help me.

    i have list of saleid is in listbox when select from listbox the sale_id is shown in text box. Using this sale_id textbox collection records shown in subform and i want sum of the collection amts.

    Please reply as early as possible

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    Not going to work with subform in Datasheet view. Use Single or Continuous view so the form footer section is available. Put textbox in footer with the Sum calculation. Then textbox on main form can refer to the subform textbox.
    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
    sireesha is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Oct 2012
    Posts
    50
    yes i had seen that method. but the subform shown in datasheet view only. so i write a code for that. its working.

    i have one more problem. how to count records in datasheet view depending on saleid.

    query="select * from tablename where saleid=" & saleid
    i set this query to recordset.
    recordset.recordcount returns 1

    but i have more records. i need to count the records depending on saleid.

    please help me.

  6. #6
    msoffice.vidyarthi is offline Novice
    Windows 7 64bit Access 2000
    Join Date
    Nov 2012
    Posts
    24
    To get the count of records, modify the query as:
    query="select count(*) from tablename where saleid=" & saleid

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    The subform can be Single or Continuous view. Controls in Continuous view can be arranged to appear as Datasheet. If the controls are grouped in a Layout, select all and right click Layout>Remove. Then the controls can be moved and resized as desired.
    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.

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

Similar Threads

  1. Replies: 11
    Last Post: 01-09-2012, 11:40 AM
  2. Totals from subform to main form
    By kathi2005 in forum Forms
    Replies: 4
    Last Post: 11-04-2011, 10:19 AM
  3. Master/detail form problem....
    By dkperez in forum Forms
    Replies: 5
    Last Post: 04-01-2011, 04:28 PM
  4. Master Detail Web Form - Access 2010.
    By Robeen in forum Forms
    Replies: 2
    Last Post: 03-21-2011, 02:34 PM
  5. Enable button in the master form when clicking in the detail
    By DistillingAccess in forum Programming
    Replies: 8
    Last Post: 08-03-2010, 10:54 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