Private Sub Command1_Click()
If Combo1.Text = "" Then
MsgBox "请你选择登录用户!", 16, "提示"
Exit Sub
End If
Adodc2.Recordset.Close
Adodc2.Recordset.Open "select * from user where id='" + Combo1.Text + " '"
If Adodc2.Recordset.EOF Then
MsgBox "你所输入的用户还没登记!"
Combo1.SetFocus
Else
If Text2.Text = Adodc2.Recordset.Fields("password").Value Then
Me.Hide
Form2.Show
End If
Text2.Text = ""
Combo1.SetFocus
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub
Private Sub Form_Load()
' Cmb2.Enabled = Not Cmb1.Enabled
Adodc2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path + "\db1.mdb"
Adodc2.CommandType = adCmdText
Adodc2.RecordSource = "select * from user"
Adodc2.Refresh
For a = 0 To Adodc2.Recordset.RecordCount - 1
Combo1.AddItem Adodc2.Recordset.Fields(0)
Adodc2.Recordset.MoveNext
Next
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Command1.SetFocus
End If
End Sub
如有错误,请帮忙改一下,跪谢了!