Error With my code

lundi 23 février 2015

Hi

Only a beginner so have been reading many threads and kindly using sample codes to build my database.



I recently downloaded some code to create a simple login form with an option to load a different etc for Admin or Users.



When I tried to run the code I keep getting some of it highlighted telling me its incorrect.



I later found out that the person I downloaded it from identified there was a little error in code but I cant understand where it is.



Can anyone read what I have downloaded and hopefully spot what i need to change.



Thanks



Jon







Private Sub Command1_Click()

Dim UserLevel As Integer



If IsNull(Me.txtLoginID) Then

MsgBox "Please enter LoginID", vbInformation, "LoginID Required"

Me.txtLoginID.SetFocus

ElseIf IsNull(Me.txtPassword) Then

MsgBox "Please enter password", vbInformation, "Password Required"

Me.txtPassword.SetFocus

Else

'process the Job



If (IsNull(DLookup("UserLogin", "tblUser", "UserLogin ='" & Me.txtLoginID.Value & "'"))) Or

(IsNull(DLookup("password", "tblUser", "Password = '" & Me.txtPassword.Value & "'"))) Then


MsgBox "Incorrect LoginID or Password"

Else

UserLevel = DLookup("UserSecurity", "tblUser", "UserLogin = '" & Me.txtLoginID.Value & "'")

DoCmd.Close

If UserLevel = 1 Then

'MsgBox "LoginID and Password Correct!"

DoCmd.OpenForm "Navigation form"

Else

DoCmd.OpenForm "Customer"



End If

End If



End If

End Sub

Error With my code

0 commentaires:

Enregistrer un commentaire

Labels