Link to home
Start Free TrialLog in
Avatar of CascadeGeneral
CascadeGeneralFlag for United States of America

asked on

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
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

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
Avatar of CascadeGeneral

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial