Results 1 to 2 of 2
  1. #1
    projectpupil7 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2014
    Posts
    37

    Sum specific values on subform and place result on another subform.

    Hi All, i know this may be breaking rules on db design but this needs to be.



    The forms in the code are subforms on a TabControl on a main form.

    I have this code which needs to add together only the areas [Area] of records with a FloorNumber field value of 1 or 2 or 3 or 4.

    At the moment the code works for one entry of 1 in the form frmRoomDetails. I'm guessing i need For Next or something like that but i don't know and also unsure of how to code it.

    Private Sub FloorNumber_AfterUpdate()

    If [Forms]![frmSiteDetails]![frmRoomDetails].[Form]![FloorNumber] = 1 Then

    [Forms]![frmSiteDetails]![frmFloorsDetails].[Form]![Text8].Value = [Forms]![frmSiteDetails]![frmRoomDetails].[Form]![Area]

    End If

    End Sub

  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
    53,633
    Are you trying to save aggregate data? Why?

    Cannot add up multiple records that way. Would have to open a RecordSet object and loop through records or physically move to each record on the form.
    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: 4
    Last Post: 05-23-2014, 01:22 AM
  2. SubForm Result
    By Mahendra1000 in forum Access
    Replies: 7
    Last Post: 10-30-2013, 01:25 PM
  3. displaying query result as a subform
    By uzair_rosli in forum Access
    Replies: 4
    Last Post: 02-26-2013, 04:29 AM
  4. Replies: 2
    Last Post: 02-12-2013, 11:23 AM
  5. View Macro Result in subform
    By rato999 in forum Programming
    Replies: 1
    Last Post: 01-23-2011, 09:34 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