Moudle是模块,主要是为了方便一些公共函数的调用而设计的.
你可以在模块里面声明全局变量和结构,函数等等
简单的数据库连接方法
Dim db1 As Database
Dim cd As Recordset
Dim i As Single
Set db1 = OpenDatabase(App.Path + "./login.mdb")
Set cd = db1.OpenRecordset("select * from login where number=1")
For i = 0 To 9
If IsNull(cd.Fields(i).value) = True Then
Text1(i).Text = ""
GoTo inerr
End If
Text1(i).Text = cd.Fields(i).value
inerr:
Next i
Text1(10).Text = cd!username
Text1(11).Text = cd!Password
cd.Close
db1.Close