Trying to Add 2 Label totals (Sum) 
Author Message
 Trying to Add 2 Label totals (Sum)

Help trying to add to label fields

Label2 = 2
Label2 = 2

Answer i get 22

How do i get 4 ?????



Wed, 28 Mar 2001 03:00:00 GMT  
 Trying to Add 2 Label totals (Sum)
The caption property of a label is a string.  If you try:

Result = Label2.Caption + Label2.Caption

you will CONCATENATE two strings, not add two
values.  Try this:

Dim LabelValue As Integer

LabelValue = Val(Label1.Caption) +Val(Label2.Caption)

There are other VB functions to convert data types:
 CInt, Int, etc.  See the VB Help.
---------------


Quote:
> Help trying to add to label fields

> Label2 = 2
> Label2 = 2

> Answer i get 22

> How do i get 4 ?????



Thu, 29 Mar 2001 03:00:00 GMT  
 Trying to Add 2 Label totals (Sum)
try convert the data type from string to integer befor you added those two
label fields.



Quote:
> Help trying to add to label fields

> Label2 = 2
> Label2 = 2

> Answer i get 22

> How do i get 4 ?????



Fri, 30 Mar 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Report showing BOTH Aggregate Sum of Display records and Total Sum by Group

2. Adding different sorted totals into a grand total field

3. Summing years totals

4. sum total in report

5. Bulding sums on running totals

6. summing a running total

7. Grand Total (SUM) in text or time field?

8. Total Sum Times in a column

9. Creating custom sum total

10. Buf with sum in subtotal/grand total

11. sum a running total

12. Close but...trying to sum DBList output

 

 
Powered by phpBB® Forum Software