jessmas
09-07-2003, 10:09 PM
I have 11 textboxes on my form and they are all array's
txtOne(0)
txtOne(1)
etc..etc..
I want to put numbers into txtboxes (0) to (9), in txtOne(10) I want the total of all the numbers in the (0) to (9).
Can someone help me with a bot of code, please
Thanks in advance
Thinker
09-07-2003, 10:13 PM
What have you tried yourself?
jessmas
09-07-2003, 10:18 PM
What have you tried yourself?
Dim Tot As Double
Dim C As Integer
Select Case Index
Case 0 To 9
For C = 0 To 9
Tot = Tot + Val(txtOne(C))
Next
txtOne(10) = Format(Tot, "###,##0.00")
Case 57 To 70
For C = 57 To 70
Tot = Tot + Val(txtOne(C))
Next
txtOne(71) = Format(Tot, "###,##0.00")
txtOne(72) = Format(Tot * 0.14, "###,##0.00")
txtOne(73) = Format(Tot * 1.14, "###,##0.00")
Case 87 To 99
For C = 77 To 99
Tot = Tot + Val(txtOne(C))
Next
txtOne(100) = Format(Tot, "###,##0.00")
txtOne(101) = Format(Tot * 0.14, "###,##0.00")
txtOne(102) = Format(Tot * 1.14, "###,##0.00")
End Select
On Error GoTo Numericfield
S = Tdef.Fields(Index).Properties(24).Value
Exit Sub
Numericfield:
txtOne(Index) = Format(txtOne(Index), "###,##0.00")
End Sub
Thinker
09-07-2003, 10:21 PM
What sub is this code in?
jessmas
09-07-2003, 10:25 PM
What sub is this code in?
Private Sub txtOne_LostFocus(Index As Integer)
Thinker
09-07-2003, 10:29 PM
Ok, what does this do then. I can't guess what problem you are having.
jessmas
09-07-2003, 10:35 PM
Ok, what does this do then. I can't guess what problem you are having.
It doesn'nt do anything, it does'nt give me errors. Nothing..
Thinker
09-08-2003, 10:45 AM
You need to set a breakpoint on the Select Case Index line and then
single-step through the code inspecting variables and what lines of code
are being executed. Look here for my tutorial on debugging code...
http://www.visualbasicforum.com/showthread.php?threadid=9415
It will tell you how to do these things.