Office中国论坛/Access中国论坛

标题: 求助! [打印本页]

作者: zxcnet    时间: 2010-3-4 16:33
标题: 求助!
以下代码为统计[text1]至[text2]之间有多少个能被3整除的数
Dim I, J
J = 0
For I = [Text1] To [Text2]
If I / 3 - Int(I / 3) = 0 Then
J = J + 1
End If
Next I
[Text3] = J

现在想设一个字段能将这些数罗列出来,请问改如何操作?
作者: zyp    时间: 2010-3-4 17:34
Dim I As Integer,A as  Integer,B as  Integer,MyStr as string
a=me.text1
b=me.text2
mystr=""
for i=a to b
      if i mod 3=0 then
          mystr=mystr & i &";"
      end if
next i
if len(mystr)>0 then  mystr=left(mystr,len(mystr)-1)
msgbox "在指定范围内,能被3整除的数有("& mystr &")"
作者: zxcnet    时间: 2010-3-5 10:06
非常感谢!




欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3