Tried it, no change in behavior. Still getting the sum to show up in single form view, but getting #Error in datasheet view.
Main Topics
Browse All TopicsI have a problem with a form in datasheet view not being able to reference a control in a subform.
I have an access 2007 database with two tables: tblProjects, tblTools. These are linked in a many to many relationship with tblProjects_Tools. I have a main form frmProjects and a subform sbfrmProjects_Tools that list all the tools and their cost associated with a project. In the footer of sbfrmProjects_Tools I have a text box named "Sum" that calculates the sum of "Cost". I then reference this control on the main form using another textbox with a control source of =[Forms]![frmProjects].[Fo
This all works fine and dandy in single form view but when I switch to datasheet view, I get an error message #Error unless I expand the subform with the little [+] button. My question is, how do I get the total cost to show up in datasheet view without having to expand all the subforms. Attached is my database, need to add .accdb to the end of the filename since Experts Exchange for some reason won't accept 2007 file extensions.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
> unless I expand the subform with the little [+] button.
Unless you do, there is no subform. It's as simple as that. You want every subform on every row to be active (and calculate a sum), even when they are closed...
You will need another expression to calculate your sum independently. Either a DSum() based on a query [linking tblProjects_Tools and tblTools], or a subquery in your main form's record source, but that makes the query non-updatable. If you want that and need help, please ask.
Basically, it's a bad idea to calculate the totals for every project on a form. This should be left for reports and summary queries, not the main form.
My suggestion: hide the column in datasheet view. And also change the expression to:
= [sbfrmProjects_Tools].[For
This allows Access to link the control into the dependency chain.
(°v°)
OK, I'll correct "bad idea" to "bad style"... In my my opinion, an editing form is a dynamic object, reacting to user input as elegantly as possible. So a total of values in the subform of the current project is natural and useful. On the other hand, the application might have analytical features, using "snapshot" data to produce like all totals. These two views of the data use conflicting methods. You cannot edit a GROUP BY query, a cross-tab, a report; producing analytical synthetic data on a dynamic form is often slow; it's complicated to display subtotals on forms; etc.
I agree that datasheets with subdatasheets are an awkward compromise. When I need something like that, I like "explorer views" better: a tree in the left pane and a list in the right pane. More work to set-up, but more comfort. In the current question, it's possible to display all subdatasheets: (Format | Subdatasheet | Expand All). It creates one instance of the subdatasheet for every record in the main datasheet...
(°v°)
Business Accounts
Answer for Membership
by: DatabaseMXPosted on 2009-11-06 at 16:53:49ID: 25764416
First ... Sum is a reserved word in Access. Change that text box name to txtSum
frmProject s_Tools].[ Form]![txt Sum]
Then try this ... removing the first instance of 'Form:
=[Forms]![frmProjects].[sb
mx