p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
I forgot my password Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VB How-To Ask your "How do I do this with VB?" questions in this forum.

Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 24th, 2009, 08:02 PM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Sum Total Checkboxes on a Multipage Form

Hi All,

I have a function which is intended to collate the sum total of checkboxes checked on a mulitpage form. Each checkbox has a numerical value and these values are referenced on an underlying excel spreadsheet (worksheet 3). I have been unsuccessful in getting the checkboxes to sum total what has been selected. However, I have gotten this same function to work if I embed the checkboxes onto the excel spreadsheet itself, but i need this to work on in forms. Any ideas on where the link is broken so to speak?

Private Sub CommandButton1_Click()
'
' Sum checkboxes
'
Dim rngCheckTable As Range
Dim Chk As Object
Dim dblTotal As Double
Dim dblValue As Double

On Error Resume Next

Set rngCheckTable = Excel.Worksheets(3).Range("A1:B11")
For Each Chk In frmViewResults.MultiPage1.Pages(0)
If TypeName(Chk.Object) = "CheckBox" Then
dblValue = 0
If Chk.Object.Value = True Then
dblValue = Application.WorksheetFunction.VLookup(Chk.Name, rngCheckTable, 2, 0)
End If
dblTotal = dblTotal + dblValue
End If
Next

txtbxQuantityScore.Text = dblTotal

MsgBox "Total is " & dblTotal

End Sub
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get the sum of selected checkboxes? Colleen Javascript How-To 4 March 7th, 2006 01:34 PM
Sum on a form Problem Corey Access 1 November 9th, 2005 05:43 PM
Form element "memory" - for checkboxes SoC VBScript 1 September 1st, 2004 05:35 AM
How to create a total on a form (using.... Mita Access 3 October 8th, 2003 01:48 AM
Dynamic form checkboxes Claralu Classic ASP Databases 2 August 5th, 2003 01:01 AM



All times are GMT -4. The time now is 07:42 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc