By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,224 Members | 1,143 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,224 IT Pros & Developers. It's quick & easy.

Calculating Total for Subform dispalyed on Form

P: 4
Hi,

Not really a programmer here, but have been forced into the role. I was asked to develop a basic time sheet for employees to enter time. I developed the Table without a problem. I then developed a query to limit the records displayed based upon an employee last name and a month. Once again no problem. I then stareted developing the form based on the query. The form has a subform using data sheet display. Form prompts user for month an last name (based on query mention above) and displays the selected records on the screen. Users then wanted a total so they could see how many hours they input. First attempt yielded a total for the enitre database not just the records displayed. I used this in the control source:

=Sum([hours spent])




The second attempt got an #error message using the following in the control source for the field:

=Sum([Test ime allocation Query].Form![hours spent])

Using Access 2003 on Windows XP. So, anyone have suggestions. I just need the total to display for the selected records. Would be nice if the total recalculated as people updated their time entries. Thanks in advance.

Dave
Oct 16 '06 #1
Share this Question
Share on Google+
2 Replies


MMcCarthy
Expert Mod 10K+
P: 14,534
Try this:

In the datasheet subform go to design view and in the form footer put a control named totalTime set to the following:

=Sum([hours spent])

Then on the main form put a control set to the following

=[Test ime allocation Query].Form![totalTime]

Hi,

Not really a programmer here, but have been forced into the role. I was asked to develop a basic time sheet for employees to enter time. I developed the Table without a problem. I then developed a query to limit the records displayed based upon an employee last name and a month. Once again no problem. I then stareted developing the form based on the query. The form has a subform using data sheet display. Form prompts user for month an last name (based on query mention above) and displays the selected records on the screen. Users then wanted a total so they could see how many hours they input. First attempt yielded a total for the enitre database not just the records displayed. I used this in the control source:

=Sum([hours spent])




The second attempt got an #error message using the following in the control source for the field:

=Sum([Test ime allocation Query].Form![hours spent])

Using Access 2003 on Windows XP. So, anyone have suggestions. I just need the total to display for the selected records. Would be nice if the total recalculated as people updated their time entries. Thanks in advance.

Dave
Oct 16 '06 #2

P: 4
Thanks so much. It worked.

Dave
Oct 16 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.