Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 398
  • Last Modified:

Sum Columns in MS Office Spreadsheet Control

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
CascadeGeneral
Asked:
CascadeGeneral
  • 4
1 Solution
 
Jeffrey CoachmanCommented:
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
 
Jeffrey CoachmanCommented:
0
 
CascadeGeneralAuthor Commented:
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
 
Jeffrey CoachmanCommented:
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
 
Jeffrey CoachmanCommented:
;-)
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now