编写代码如下:私有子CmdOK_Click() '单击[确认]按钮tDim sqlstr作为字符串tIf Text1 = "" Then t MsgBox "请输入用户名!", vbExclamation, "确认用户名" t Text1.SetFocus t Exit Sub tElse t sqlstr = "Select * from密码表where用户名='" & Text1 & "'" t Adodc1.RecordSource = sqlstr t Adodc1.Refresh