《Access子程序练习》由会员分享,可在线阅读,更多相关《Access子程序练习(2页珍藏版)》请在金锄头文库上搜索。
1、1Private Sub table()Debug.Print Tab(45); 九九乘法表Debug.Print Tab(45); =For i = 1 To 9For j = 1 To is = i & * & j & = & i * jDebug.Print s; Spc(5);Next jDebug.PrintNext iEnd Sub2控件过程的建立建立窗体,在命令按钮输入代码,在标签和文本框中显示结果。Private Sub Command3_Click()Dim x, yx = 100: y = 300Label0.Caption = Str(x + y)Text1.Value
2、= yEnd Sub3过程的调用计算大圆、小圆的面积建立了模块(名为ff(x)计算圆面积),建立窗体。在通用、声明段定义公共变量:Public s As SinglePublic x As IntegerOption Compare DatabaseSub ff(r As Integer)Dim s As SingleConst p = 3.14s = r 2 * pMsgBox sEnd SubPrivate Sub Command1_Click()x = Text4.ValueCall ff(x)End SubPrivate Sub Command1_Click()x = Text5.Valueff x End Sub