access VBA编程语言
发布网友
发布时间:2022-04-23 08:44
我来回答
共1个回答
热心网友
时间:2022-06-18 12:45
设窗体上text1为输入文本框, text2为结果文本框,, cmd1为计算按钮, cmd2为清空按钮,则
private sub cmd2_click()
text1.value=""
text2.value=""
text1.setfocus
end sub
private sub cmd1_click()
dim I as integer, N as integer, R as integer
N = text1.value
for I = 1 to N
R =R+((I mod 2)*2-1)*I
next
text2.value = R
end sub