Solved

Sum Columns in MS Office Spreadsheet Control

Posted on 2009-05-14
5
373 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
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.

758 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now