输入用户名和密码登陆的框的再次提问
那个这次我重建了一个数据库和表那个程序这样写通过了
Public DataPath As String
Public DataConnectString As String
Private Sub Form_Load()
DataPath = App.Path + "\db2.mdb"
DataConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + DataPath + ";Persist Security Info=False" + ";Jet OLEDB:Database Password="
Adodc1.ConnectionString = DataConnectString
End Sub
Private Sub Command1_Click()
On Error Resume Next
Dim MPassword As String
Adodc1.RecordSource = "select * from wht where name='" & Text1.Text & "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
MPassword = Adodc1.Recordset.Fields("password")
If Text1.Text = MPassword Then
Form2.Show
Unload Me
Else
MsgBox "密码不正确,请您确认后重新输入", , "界面管理登陆"
Text2.Text = ""
Text2.SetFocus
End If
Else
MsgBox "对不起 没有此用户的信息", , "界面管理登陆"
Text1.Text = ""
Text2.Text = ""
End If
End Sub
运行没有问题
但是我像把那个前面的那个加载数据库的那个写在Module1.bas上 能够被这个工程的所有form调用 怎么就不行了呢