Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 20th, 2010, 09:15 PM
Registered User
 
Join Date: Mar 2010
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
Default Grand Total Code does not work in Access2003 Data Access Page

I found the code below on the MS site, it fixes the issue where the Grand totals are blank in a data access page; and it works in the Northwind example but not in my page;

---------------------------------------------------------------------------------------
<SCRIPT language=vbscript for=MSODSC event=DataPageComplete(obj)>
Const FooterLevel = 3

Dim curGrandTot
Dim sectionFooter

'[ProductSales Grand Total Sum] is the name of a text box that
'should already reside in the Navigation: GroupLevel0
'section of this data access page.
If [Comps Grand Total Sum].value = "" Then
Set sectionFooter = obj.DataPage.FirstSection

While Not (sectionFooter Is Nothing)
'Test to make sure that focus is in
'the Footer: GroupLevel0 section.
If sectionFooter.type = FooterLevel Then
'The following line accumulates each of the totals per group
'to create a grand total.
curGrandTot = curGrandTot + CCur(sectionFooter.HTMLContainer.children("Sum Of Comps").value)
End If
Set sectionFooter = sectionFooter.NextSection
Wend

'Fill the control with the frand total.
[Comps Grand Total Sum].value = curGrandTot
End If

</SCRIPT>



But when I try using it in my page I get the following error:

"Line: 218
Error: Object required: 'sectionFooter.HTMLContainer.children(...)'"

Please Help!





Similar Threads
Thread Thread Starter Forum Replies Last Post
multiple formula fields as grand total position of cross tab report design in vb.net MasterIT Crystal Reports 0 July 29th, 2009 04:59 AM
calculating grand total blkskullwork Javascript 2 December 18th, 2006 10:36 AM
PIVOT TABLE Grand Total ... pls help !!!! laky Access VBA 0 June 2nd, 2006 03:47 AM
PIVOT TABLE Grand Total ... pls help !!!! laky Access 0 June 2nd, 2006 02:15 AM
Grand Total mateenmohd Access 6 April 8th, 2005 07:30 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.