access,窗体中,文本框要调用一个查询的值,请问该怎么做??
展开全部
Private Sub command1_Click()
Dim a As String, b(20) As Integer, i As Integer, j As Integer, c(20) As Integer, 位置 As Integer, 总和 As Integer, 输出文本 As String
a = Me.textbox1
For i = 1 To 20
j = InStr(1, a, ",", vbTextCompare)
b(i - 1) = Left(a, j - 1)
a = Mid(a, j + 1)
Next i
总和 = 0
For i = 1 To 20
位置 = 1
For j = 1 To 20
If b(i) > b(j) Then 位置 = 位置 + 1
Next j
c(位置) = b(i - 1)
总和 = 总和 + b(i - 1)
Next i
For i = 0 To 20
输出文本 = 输出文本 & CStr(c(i - 1)) & " "
Next i
输出文本 = 输出文本 & " 最大值:" & CStr(c(19)) & " 最小值:" & CStr(c(0)) & " 总和:" & CStr(总和) & " 平均值:" & CStr(总和 / 20)
MsgBox 输出文本
End Sub
Dim a As String, b(20) As Integer, i As Integer, j As Integer, c(20) As Integer, 位置 As Integer, 总和 As Integer, 输出文本 As String
a = Me.textbox1
For i = 1 To 20
j = InStr(1, a, ",", vbTextCompare)
b(i - 1) = Left(a, j - 1)
a = Mid(a, j + 1)
Next i
总和 = 0
For i = 1 To 20
位置 = 1
For j = 1 To 20
If b(i) > b(j) Then 位置 = 位置 + 1
Next j
c(位置) = b(i - 1)
总和 = 总和 + b(i - 1)
Next i
For i = 0 To 20
输出文本 = 输出文本 & CStr(c(i - 1)) & " "
Next i
输出文本 = 输出文本 & " 最大值:" & CStr(c(19)) & " 最小值:" & CStr(c(0)) & " 总和:" & CStr(总和) & " 平均值:" & CStr(总和 / 20)
MsgBox 输出文本
End Sub
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
文本框的值来源写查询就行了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询