个你一个例子吧,系统登陆的,换汤不换药,都差不多
![](https://video.ask-data.xyz/img.php?b=https://iknow-pic.cdn.bcebos.com/1ad5ad6eddc451da445c3408b0fd5266d11632ae?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto)
![](https://video.ask-data.xyz/img.php?b=https://iknow-pic.cdn.bcebos.com/72f082025aafa40f96f4f53ead64034f78f01926?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto)
Dim nam As String, pass As String
Private Sub Command1_Click()
If Text1 = "" Then
MsgBox "用户名为空!"
ElseIf Text1 <> nam Then
MsgBox "用户名错误!"
Text1 = ""
Text1.SetFocus
Else
If Text2 = "" Then
MsgBox "输入密码为空!"
ElseIf Text2 <> pass Then
MsgBox "输入密码错误!"
Text2 = ""
Text2.SetFocus
Else
MsgBox "登陆成功!"
End If
End If
End Sub
Private Sub Form_Load()
Adodc1.Visible = False
Label1.Caption = "用户名:"
Label2.Caption = "密 码:"
Text1 = ""
Text2 = ""
Command1.Caption = "登录"
Call conn
End Sub
Sub conn()
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Login.mdb;Persist Security Info=False"
Adodc1.RecordSource = "select * from dl"
Adodc1.Refresh
nam = Adodc1.Recordset(0)
pass = Adodc1.Recordset(1)
End Sub