[求助]我连接数据库为什么会出错呢?
Dim id As String
Dim pwd As String
Dim ws As Workspace
Dim db As Database
Dim rs As DAO.Recordset
Dim sql As String
Set ws = DBEngine.Workspaces(0)
'打开数据库地址
Set db = ws.OpenDatabase("F:\我的作品\数据库\学生考勤\xs.mdb")
If IsNull(Me.Text10) Or IsNull(Me.Text12) Then
MsgBox ("请输入完整")
Else
id = Trim(Me.Text10)
pwd = Trim(Me.Text12)
sql = "select * from xs where xh='" & id & " ' and pas='" & pwd & "'"
'数据库执行查询,并把结果放入rs
set rs = db.Execute(sql)
End If
出错对话框在附件里
我要怎样才能正确连接这个数据库呢?请大家帮忙看看吧,谢谢