使用vb中的adodc控件找到你的access数据源,把它的路径复制下来
在引用找adodb把这个引用过来如下:
Public conn As New ADODB.Connection
Dim rs_load As New ADODB.Recordsetconn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\school.mdb;Persist Security Info=False"
conn.Open
If Trim(txtname.Text) = "" Then            '判断输入的用户名是否为空
   MsgBox "没有这个用户", vbOKOnly + vbExclamation, ""
   txtname.SetFocus
Else
   strname = Trim(txtname.Text)
   sql = "select * from users where username='" & strname & "'"
   rs_load.Open sql, conn, 3, 2, -1
   If rs_load.EOF = True Then
      MsgBox "没有这个用户", vbOKOnly + vbExclamation
      txtname.SetFocus
   Else
      If Trim(rs_load.Fields(1)) = Trim(txtpwd.Text) Then
          user1 = txtname.Text
          user_descrip = rs_load.Fields(2)
          conn.Close
          Unload Me
          mdi.Show
      Else
          MsgBox "密码不正确", vbOKOnly + vbExclamation, "警告"
          txtpwd.SetFocus
          conn.Close
      End If
   End If
End If
num = num + 1
If num = 3 Then
Unload Me
End If