Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / December 2007

Tip: Looking for answers? Try searching our database.

summing on subform and form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Betsy - 19 Dec 2007 21:26 GMT
this seemed so easy when I first started, but everything I tried has not
worked.  

I have a database with a form: form1 and a subform: subform1
the subforms are connected to the form by the SchoolID
each school form will have a subform for each month.
the subforms contain many numbers and calculations which seem for the moment
to be working.  I have a total field on each subform which I will need to sum
and add to the parent form as a grand total.  since I cannot SUM calculated
fields I figured I would just pass the value into another field on the
subform that I could then SUM.  

Currently I have built andexpression in the AFTER UPDATE field that says:

Me![subform1].Form![new ref] = Me![subform1].Form![tot ref]

This will not pass the value to the new_ref field.  
then I figured I'd add some code to the field on the form that says:

Me!Referrals_to_date = [subform1].Form![new_ref]

I haven't tried this yet as i can't get the first code to work, but would
that be the way to go?
Steve Schapel - 19 Dec 2007 23:02 GMT
Betsy,

When you are talking about using code on the After Update event, it
seems to me from what you have told us so far that you are about the
After Update event of a control on the subform1 subform... am I right?
If so, the syntax Me![subform1] will be wrong, because "Me" already
refers to subform1, and subform1 doesn't have a subform named
subform1... if you catch my drift.  Anyway, I may be off track here,
because I can't quite understand what you are trying to do, and I can't
see the point of allocating the value of a control on a form or subform
to another control on the form or subform.

If by "school form will have a subform for each month" you mean you will
have separate subforms for each month, then this would also, on the face
of it, seem to be a bad idea.

Maybe this will help...  You can put an unbound textbox on the main
form, and in the Control Source enter the equivalent of this:
=[subform1]![tot ref]

And if you had 2 subforms, each with a [tot ref] control, then you can
do like this in the textbox on the main form:
=[subform1]![tot ref]+[subform2]![tot ref]

In other words, if I get the gist of what you want, then using code is
probably not applicable.

Signature

Steve Schapel, Microsoft Access MVP

> this seemed so easy when I first started, but everything I tried has not
> worked.  
[quoted text clipped - 19 lines]
> I haven't tried this yet as i can't get the first code to work, but would
> that be the way to go?
Betsy - 20 Dec 2007 14:08 GMT
Thanks for your help! You make a lot of sense and I can follow most of your
advise. I like your solution, unfortunately [tot ref] is a calculated field
therefore I can't just pass it on to the form as is.  I need another way.  
This seems to be the sticking point and why I was trying to use code to get
it there.

Any other suggestions?

Betsy

> Betsy,
>
[quoted text clipped - 46 lines]
> > I haven't tried this yet as i can't get the first code to work, but would
> > that be the way to go?
Betsy - 20 Dec 2007 14:11 GMT
Never mind!  I found a typo and your solution DID work.  thank you very much!

> Thanks for your help! You make a lot of sense and I can follow most of your
> advise. I like your solution, unfortunately [tot ref] is a calculated field
[quoted text clipped - 56 lines]
> > > I haven't tried this yet as i can't get the first code to work, but would
> > > that be the way to go?
Steve Schapel - 20 Dec 2007 18:19 GMT
Hi Betsy,

Glad to see you have it working now, as otherwise I would not have
understood what you meant by:
> ... unfortunately [tot ref] is a calculated field
> therefore I can't just pass it on to the form as is.

Signature

Steve Schapel, Microsoft Access MVP

Betsy - 20 Dec 2007 18:26 GMT
WEll, it wouldn't work so I thought it was because it was a calculated
field.....Shows what I know :)

thanks again.  I'm moving along now.

> Hi Betsy,
>
> Glad to see you have it working now, as otherwise I would not have
> understood what you meant by:
> > ... unfortunately [tot ref] is a calculated field
> > therefore I can't just pass it on to the form as is.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.