2 在Select 语句给列加上别名再以别名访问
Adodc1RecordSource = "select SUM(总金额) money from Purchase where month(日期) = '" & m & "'"
Adodc1RecordsetFields("money")Value
把 text3text=text1text+text2text 这句改成下面这句就可以了,
val是提取text中的数字,这样才可以加减运算,只有变成数字,才能加减运算。
text3text=val(text1text)+ val(text2text)
如图下图,不懂可以追问我
Private Sub Command1_Click()a = Val(Text1)
s = Len(a)
Sum = 0
For i = 1 To s
Sum = Sum + a Mod 10
a = a \ 10
Next i
Text2 = Str(Sum)
End Sub
Private Sub Command2_Click()
Text1 = ""
Text1SetFocus
Text2 = ""
End Sub
Private Sub Command3_Click()
End
End SubPrivate Sub Command1_Click()
Text1Text = addNumbers(100, 2,1) '1,3,5,
End Sub
Private Function addNumbers(ByVal lMax As Long, ByVal nStep As Integer,By nStart as integer) As Long
Dim sum As Long
Dim i As Long
For i = nStart To lMax Step nStep
sum = sum + i
Next
addNumbers = sum
End Function你好!
SUM=SUM+VAL(S)
就是把S这个字符型变量转化为数值后和变量SUM相加,所得的值重新赋值给变量SUM。
比如:
S="2"
SUM=3
SUM
=
SUM+VAL(S)
=
3+VAL("2")
=
3+2
=5
这时候SUM就变成5了
如果对你有帮助,望采纳。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)