Sum Subform and store on form.

  • Thread starter Balmora via AccessMonster.com
  • Start date
B

Balmora via AccessMonster.com

ok i have this situation that i need to sum up the filtered subform and
display the total on the main form so i can use it for the next record all i
need is to find a way to sum and store on the mainform here is part of my
main form

name : Budget
ID : autonumber
MonthandYear : date/time
GazTotal : currency

ok and the sumform

name : Gaz Subform
ID : autonumber
StartDate : date/time
GazName : text
Total : currency

i dont want to use a unbound testbox in the footer of my subform to sum the
total so i thought of using something like

Private Sub Form_Current()
Me.GazTotal = DSum("[Total]", "Gaz Subform", "ID = " & Me.ID)
End Sub

but when i open my mainform called Budget, i get a run-time error '3078' and
when i click on debug, it hight lites Me.GazTotal = DSum("[Total]", "Gaz
Subform", "ID = " & Me.ID)
what am i doing that is not good any ideas??

thanks for all your help!
 
P

pietlinden

ok i have this situation that i need to sum up the filtered subform and
display the total on the main form so i can use it for the next record all i
need is to find a way to sum and store on the mainform here is part of my
main form

name : Budget
ID : autonumber
MonthandYear : date/time
GazTotal : currency

ok and the sumform

name : Gaz Subform
ID : autonumber
StartDate : date/time
GazName : text
Total : currency

i dont want to use a unbound testbox in the footer of my subform to sum the
total so i thought of using something like

Private Sub Form_Current()
Me.GazTotal = DSum("[Total]", "Gaz Subform", "ID = " & Me.ID)
End Sub

but when i open my mainform called Budget, i get a run-time error '3078' and
when i click on debug, it hight lites  Me.GazTotal = DSum("[Total]", "Gaz
Subform", "ID = " & Me.ID)
what am i doing that is not good any ideas??

thanks for all your help!

why not use an unbound textbox on the subform to calculate the sum,
and then hide it (set visible=False) and then reference it in your
main form. See Keri Hardwick's article at www.mvps.org/access If you
search for her name, she only has like 4 articles there...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top