While trying to open my Access DB, I am getting the message that "the file already in use". This file open with a username/password, below is the code used. Is it due any thing wrong in the code. this code I am using for long time.
Code: Select all
Private Sub Command4_Click()
'Dim UserLeve As Integer
Dim dbPassword As String
If IsNull(Me.UserID) Then
MsgBox "Please Enter LoginID", vbInformation, "LoginID Required"
Me.UserID.SetFocus
ElseIf IsNull(Me.PWord) Then
MsgBox "Please Enter Password", vbInformation, "Password Required"
Me.PWord.SetFocus
Else
'Process the Job
If (IsNull(DLookup("UserLogIn", "tblUser", "UserLogIn ='" & Me.UserID.Value & "'"))) Then
MsgBox "Incorrect username"
ElseIf (Me.PWord.Value <> DLookup("Password", "tblUser", "UserLogIn ='" & Me.UserID.Value & "'")) Then
MsgBox "Incorrect password entered"
Else
UserLevel = DLookup("UserSecurity", "tblUser", "UserLogIn ='" & Me.UserID.Value & "'")
DoCmd.Close
If UserLevel = "Admin" Then
DoCmd.OpenForm "Navigation FORM"
ElseIf UserLevel = "Admin1" Then
DoCmd.OpenForm "Navigation FORM-Admin"
End If
End If
End If
End Sub
Regards,
VKKT