T
Tourish
Guest
i want the username and password fields to be empty as the db opens at the moment the they dont clear, i thought the .value ="" on them would clear them but its not working am i missing something else?
Private Sub Login_Click()
On Error GoTo Err_Login_Click
Dim dbCurrent As Database
Dim dbTable As Recordset
Set dbCurrent = DBEngine.Workspaces(0).Databases(0)
Set dbTable = dbCurrent.OpenRecordset("tblPasswords")
Record = 1
Do Until Record = 0
If [UserName] = dbTable![UserName] And [Password] = dbTable![Password] Then
Record = 0
Else
dbTable.MoveNext
End If
Loop
If Record = 0 Then
Dim stDocName As String
Dim stLinkCriteria As String
MsgBox "login successful"
stDocName = "switchboard"
UserName.Value = ""
Password.Value = ""
DoCmd.Close
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
Exit_Login_Click:
Exit Sub
Err_Login_Click:
MsgBox "User Name or Password incorrect!"
UserName.Value = ""
Password.Value = ""
Resume Exit_Login_Click
End Sub
Private Sub Login_Click()
On Error GoTo Err_Login_Click
Dim dbCurrent As Database
Dim dbTable As Recordset
Set dbCurrent = DBEngine.Workspaces(0).Databases(0)
Set dbTable = dbCurrent.OpenRecordset("tblPasswords")
Record = 1
Do Until Record = 0
If [UserName] = dbTable![UserName] And [Password] = dbTable![Password] Then
Record = 0
Else
dbTable.MoveNext
End If
Loop
If Record = 0 Then
Dim stDocName As String
Dim stLinkCriteria As String
MsgBox "login successful"
stDocName = "switchboard"
UserName.Value = ""
Password.Value = ""
DoCmd.Close
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
Exit_Login_Click:
Exit Sub
Err_Login_Click:
MsgBox "User Name or Password incorrect!"
UserName.Value = ""
Password.Value = ""
Resume Exit_Login_Click
End Sub