Hi all,
I have created a Login form that opens as soon as my database opens.
the username and the password textboxes both work they accept the username and the password but my problem is that each time I login it keeps adding my login name and password to my table.
tested 4 times then went into my table and there was my username and password 4 times, any ideas what is going
on below is the code I'm using.
Thanks for any help in advance
Appologise now I think I just posted this in the wrong place. sorry
Code:
Option Compare Database
Option Explicit
Private Sub btnLogin_Click()
Dim rs As Recordset
Set rs = CurrentDb.OpenRecordset("tblLogin", dbOpenSnapshot, dbReadOnly)
rs.FindFirst "UserName='" & Me.txtUsername & "'"
If rs.NoMatch = True Then
Me.lblWronguser.Visible = True
Me.txtUsername.SetFocus
Exit Sub
End If
Me.lblWronguser.Visible = False
If rs!Password <> Me.txtPassword Then
Me.lblWrongPass.Visible = True
Me.txtPassword.SetFocus
Exit Sub
End If
Me.lblWrongPass.Visible = False
DoCmd.OpenForm "frmNavigation"
DoCmd.Close acForm, Me.Name
End Sub