Results 1 to 9 of 9
  1. #1
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496

    Count what is in a field

    I have a continuous sub form on a main form - each record has a field that has seating number.



    Is there a way to tally/count and then minus that tally from the number on the main form

    so if the mainform has 250 seats

    it counts the field from each record in the subform field seats and then subtracts it from the 250 on the mainform.

  2. #2
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Also in the subform query I have made a field which calculates 2 different fields for seatings (teachers and students).

    I'm thinking that I could have that tallied to a total for all the rows - so row 1 seats + row 2 seats

  3. #3
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    guessing dcount will do this...

  4. #4
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    any ideas? (bump)

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,633
    Why does main form have count of seats?
    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
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Quote Originally Posted by June7 View Post
    Why does main form have count of seats?
    Click image for larger version. 

Name:	Screen Shot 2013-08-31 at 3.44.02 PM.png 
Views:	17 
Size:	71.8 KB 
ID:	13629

    Each theatre has a set number of seats for the day of the booking. Each school I have join the same booking has to declare how many seats they want on the day. If 3 schools join with 30 seats each I have to minus the total (90 seats) from the theatre seats (which could be anything... say 120 seats).

    The main form just displays how many seats are remaining 120 - 90

    But I need to tally each total of all the schools of that booking first to be able to display how many seats are remaining.

  7. #7
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Quote Originally Posted by Ruegen View Post
    Click image for larger version. 

Name:	Screen Shot 2013-08-31 at 3.44.02 PM.png 
Views:	17 
Size:	71.8 KB 
ID:	13629

    Each theatre has a set number of seats for the day of the booking. Each school I have join the same booking has to declare how many seats they want on the day. If 3 schools join with 30 seats each I have to minus the total (90 seats) from the theatre seats (which could be anything... say 120 seats).

    The main form just displays how many seats are remaining 120 - 90

    But I need to tally each total of all the schools of that booking first to be able to display how many seats are remaining.
    I've put =Count([CalcField])) in the header of the subform and that seems to do the job. Only I am hoping that is restricted to just that subform query and not the whole table...

  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,633
    Yes, the Count() function only considers the form records, not the table. Domain Aggregate functions (DCount, DSum, DLookup, etc) pull from table directly.
    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
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    I have used Sum() as it ads the records and done that on the subform then made it invisible and then done another calc on the main form to minus from the seat number. Works.

    Thanks to June7 too.

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

Similar Threads

  1. Replies: 4
    Last Post: 07-28-2013, 12:40 AM
  2. COUNT Group Count Records COUNT FUNCTION
    By PMCOFFEY in forum Access
    Replies: 9
    Last Post: 11-09-2012, 09:40 PM
  3. Multi-value field count
    By whitneynf08 in forum Queries
    Replies: 3
    Last Post: 08-07-2012, 11:02 AM
  4. Count of Certain Values In a Field
    By tsn.s in forum Queries
    Replies: 4
    Last Post: 08-06-2012, 08:32 AM
  5. Replies: 2
    Last Post: 06-02-2012, 12:49 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