Access数据库,想用Vb做一个修改密码的窗体,出现两个bug,求高手指教

2024-12-26 16:43:33
推荐回答(1个)
回答1:

Private Sub 确定_Click()
Dim ai, aj, temp3, temp4
ai = "[用户名]='" & yhm & "'"
aj = "[密码]='" & jmm & "'"
temp3 = 0
temp4 = 1
temp3 = DLookup("ID", "用户", ai)
temp4 = DLookup("ID", "用户", aj)
If temp3 = temp4 Then
    If Nz(xmm) = Nz(qr) Then
       DoCmd.RunSQL "UPDATE 用户 SET 密码='" & xmm & "' WHERE 用户名='" & [forms]![修改密码]![yhm] & "'"
      MsgBox xzh & "密码修改成功"
    Else
      MsgBox "新密码和确认密码不一致,不能修改密码"
    End If
Else
  MsgBox "旧密码输入有误"
End If
End Sub