Results 1 to 11 of 11
  1. #1
    Nosaj08 is offline Advanced Beginner
    Windows XP Access 2002 (version 10.0)
    Join Date
    Apr 2009
    Posts
    40

    Question Expense Totals

    Hey Everyone,


    Hopefully I am in the right section for this. What I am trying to do is create an expense section for my events database and I am not sure how to set it up. Currently, I have each event, along with its information set up as a row in my events table. However, now that my boss wants to be able to add in a section to itemize expenses for each event and list its totals, I am not sure how to integrate it into my current table. Any ideas? TIA!

    Jason

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Use another table for expenses and put the EventID PrimaryKey in this table as a ForeignKey. Then have a MainForm bound to the Event table query and a SubForm on this MainForm that is bound to the Expenses table query with the EventID and the LinkChild/MasterFields properties. As you add expenses for each event, the ForeignKey will be filled in automatically by Access.

  3. #3
    Nosaj08 is offline Advanced Beginner
    Windows XP Access 2002 (version 10.0)
    Join Date
    Apr 2009
    Posts
    40
    Great, I will try that out and see if it will work. Thanks!

    Jason

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Let us know how you make out.

  5. #5
    Nosaj08 is offline Advanced Beginner
    Windows XP Access 2002 (version 10.0)
    Join Date
    Apr 2009
    Posts
    40
    Hey RuralGuy,
    Everything worked perfectly. However I am having a little trouble with adding a totals section to the main form. Here is what I did:

    After creating the main form & table and the sub form & table, I created an extra field in the sub form that would take the sum of the amounts column. That worked just fine. However, I would like to hide that column and call it out in the main form. I created a text box in the main form with the following expression:

    [Forms]![Events]![Expenses].[Form]![Totals]

    Where as Events is my main form, Expenses is my subform, and Totals is the name of of the field that I want to call out. When, I plug this into the text box, all I get is "#Error." Any idea, where I went wrong? Thanks!

    Jason

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Did you put the Totals control in the footer of the SubForm because that is where it belongs.

  7. #7
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    The syntax for the ControlSource of a TextBox on your MainForm would be:
    =Expenses.Form!Totals

  8. #8
    Nosaj08 is offline Advanced Beginner
    Windows XP Access 2002 (version 10.0)
    Join Date
    Apr 2009
    Posts
    40
    Yes, I had the Totals control in the footer of the subform. I just plugged in your expression and am now getting #Name?. Does this mean that there is a problem with one of the titles? I double checked everything to make sure there were no typos and all names matched. Any Ideas? Thanks!

  9. #9
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    You know that a form is displayed on another form by the use of a SubFormControl, right? This SubFormControl has a name of its own that usually defaults to the name of the form it is displaying, but it does not have to be that way. It is the SubFormControl that is in the syntax. =SubFormControlName.Form.Totals

  10. #10
    Nosaj08 is offline Advanced Beginner
    Windows XP Access 2002 (version 10.0)
    Join Date
    Apr 2009
    Posts
    40
    Yup, thats where I was going wrong. I was referring to the Sub Form that I created and not the Sub Form Control. Works great now. Thanks for all your help RuralGuy!

    Jason

  11. #11
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    You're very welcome. You will still have an issue when there are no records in the SubForm. If we're done then try out the link in my sig.

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

Similar Threads

  1. Query - using Max Totals with Criteria
    By mslieder in forum Access
    Replies: 1
    Last Post: 06-19-2013, 06:02 AM
  2. Group Totals in a form
    By mai1081 in forum Forms
    Replies: 1
    Last Post: 05-14-2008, 06:11 PM
  3. Day of Week Totals
    By ddog171 in forum Queries
    Replies: 1
    Last Post: 03-18-2006, 07:01 PM
  4. query - totals
    By mslieder in forum Access
    Replies: 0
    Last Post: 02-22-2006, 06:11 PM
  5. pivot table totals
    By brian12pme in forum Forms
    Replies: 0
    Last Post: 12-07-2005, 03: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