... - rs2.Open "select * from Table1 where empid='" & Text1.Tex& "'", con
-
Dim k As Integer
-
k = Sum(rs2.Fields(2))
But the Compile error has occured as "Sub or Function not defined".
So kindly reply me.
Willakawill's response will show you how you can use SQL to produce the sum, which is likely to be much quicker and more efficient (and uses much less code). But if you prefer to use your own code to add up the values, I think your error might be in
Text1.Tex& - try adding a "t" onto "Tex", and leaving a space before the "&". You have to be quite careful and precise about these little details when programming, as computers tend to take things
very literally.
I've often said, the biggest problem with computers is that they do what you
tell them to, not what you
want them to.