Hello, all.
I am new to VBA and have a simple question.
How to change line in VBA
The code looks like this:
Private Sub SLICC_MALIGNANCY_AfterUpdate()
Me!TOTALSCORE = Me!item1+Me!item2+......+Me!item200
End Sub
I want to add up many values. But they are too long to be shown in one line. How can I change line while maintain the statement
Thank you vary much!
Qian

How to change line within one statement?
yromanen
If you need to "split" a line of VBA code, type a space after one of the
plus signs, then type an underscore, then press Enter. like this:
Me!TOTALSCORE = Me!item1+Me!item2+ _
+Me!item200
TaiChiMaster
Hi Qian,
Try using the Eval() function, example....
Private Sub SLICC_MALIGNANCY_AfterUpdate()
Dim TotalScore as Integer
For n = 1 to 200
TotalScore = TotalScore + Eval("Me!item" & n)Next
M
e!TOTALSCORE = TotalScoreEnd Sub
Boulderdude
Hello Qian,
Are you using Excel,
Where are you getting Me!Item1, is it a cell reference ; in which case how about the SUM function.
Post some more information and I'm sure there is a way.
Chas
r3n
Thank you very much for your reply! Actually I want to know how to break the limit of the length of one line in VBA.
I am using MS Access. Me!item is the name of my fields. :)
Now I know how to do it. Thank you all!
Qian