高手帮忙呀!!!数据库名为datamaster。表名:password  两个字段: username  passwd界面里的用户名为第一个字段里的数据,密码为第二个字段里的数据。
我做完之后只能依次注销用户。怎么才能实现选择哪个用户注销哪个用户。
Private Sub Command1_Click()
If Text2.Text = "" Then
MsgBox "请选择用户", vbOKOnly + vbExclamation, ""
Text2.SetFocus
End If
If Text2.Text <> DBList1.Text Then
MsgBox "用户名不正确", vbOKOnly + vbExclamation, ""
DBList1.SetFocus
End If
If Text1.Text = "" Then
MsgBox "请输入密码", vbOKOnly + vbExclamation, ""
Text1.SetFocus
End If
If Text1.Text <> Data1.Recordset.Fields("passwd") Then
MsgBox "密码不正确", vbOKOnly + vbExclamation, ""
Text1.Text = ""
Text1.SetFocus
End If
If Text2.Text = Data1.Recordset.Fields("username") And Text1.Text = Data1.Recordset.Fields("passwd") Then
MsgBox "注销成功", vbOKOnly, "注销成功"
Text1.Text = ""
Text2.Text = ""
DBList1.SetFocusData1.Recordset.Delete
Data1.Refresh
End If
End Sub

解决方案 »

  1.   

    Private Sub List1_Click()
    a = List1.Text
    MsgBox a
    End Sub单击list产生一个值,你试试
    在注销这个a值就好了.
      

  2.   

    因为你用的是data控件,那你就必须在你选择了一个用户后,把data控件的recordset移到这个用户,然后才能删除
      

  3.   

    单击list时,把list的值给Text2,并且定位记录集指针到当前用户