Solved

Sum Columns in MS Office Spreadsheet Control

Posted on 2009-05-14
5
381 Views
Last Modified: 2013-11-28
I have a form (Form1)  in MS Access that contains an MS Office Spreadsheet Control titled "Spreadsheet0".  I want to add Text Boxes above the Spreasheet Control that show the total for each spreadsheet column.  So the Text Box named TextBox1 would show the total for Column A in the Spreadsheet, etc, etc.

If I was working in Excel with a Userform that contained a Text Box, I would use somthing like: WorksheetFunction.Sum(Columns(1)).  However, WorksheetFunction appears to not work with the Spreadsheet Control in MS Access.

How do I show the sum of the numbers in Column 1 of the Spreadsheet Control in TextBox1?

Thanks,
Greg
0
Comment
Question by:CascadeGeneral
  • 4
5 Comments
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 24392361
CascadeGeneral,

I think it would be far easire to Link the Excel Data into Access, then use the Access Sum() function to get the sum of the column.

Embedding spreadsheet controls will bloat the Database and will be much slower than linking the data...
If doing what you are asking is even possible.
:-O

Here is a sample.
Extract both files to your:  C:\
Root folder then open the DB, then open the frmData form.

JeffCoachman
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 24392363
0
 

Author Comment

by:CascadeGeneral
ID: 24399681
So are you suggesting that I link an Access table to the MS Office Spreadsheet Control, and then sum the fields in the linked Access table?  If I understand you correctly, I like the idea.  Although I am not sure how to link a MS Office Spreadsheet Control to an Access table.

If I do understand you correctly, do you know how to link an MS Office Spreadsheet Control (embedded on an MS Access Form) to an MS Access table?  I've heard that you can link an Excel Spreadsheet to an MS Access table, but I haven't seen anthing about linking an MS Office Spreadsheet 11.0 Control.

Greg
0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 500 total points
ID: 24399876
My presumption may have been incorrect,
I presumed that you had an "external" spreadsheet.

You could link this external spreadsheet into Access (no "Spreadsheet Control" needed) as a Linked table.

Then make a form out of it, and use a asimple texbox and a formula to get the total.


Jeff
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 24568384
;-)
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question