If Statement in an If statement Access 2007

Microsoft Microsoft access 2007 full ver...
September 1, 2010 at 06:40:40
Specs: Windows 7
Hi, I'm new to writing in VB and I have run into what seems like a dead end. I have some code that checks to see if a users password is correct; if it is correct, I want the code after that to check a query to see what form to open based on the users permissions (1=Power User, 2=General User, 3=Casual User) which are directly tied to the username the person types in because of my "User ID" Table. I hope that makes sense, if it doesn't, ask a question and I can be more descriptive. Here is an example of the code I am trying to use. As you can see, I want my code to check if their permissions group is 1,2, or 3, then open the corrisponding form. Thanks!!!!!


If Me.Text26.Value = DLookup("Password", "ADMIN User ID", _
"[ID]=" & Me.Combo24.Value) Then

lngMyEmpID = Me.Combo24.Value

'checks the permissions of the user logging in and brings back
'the proper form with the permissions they are allowed
If [Find Permissions of Logged In User]![PermissionsGroup] = "1" Then
DoCmd.OpenForm "Welcome Menu Screen"
End If
If [Find Permissions of Logged In User]![PermissionsGroup] = "2" Then
DoCmd.OpenForm "Welcome Menu Screen General User"
End If
If [Find Permissions of Logged In User]![PermissionsGroup] = "3" Then
DoCmd.OpenForm "Welcome Menu Screen casual user"
End If


'Close logon form and open splash screen
DoCmd.Close acForm, "Logon Screen", acSaveNo
'command below will just hide the logon screen if i need to refer to the combobox
'Me.Visible = False
'DoCmd.OpenForm "Welcome Menu Screen"
Else
MsgBox "Password Invalid. Please Try Again", vbOKOnly, _
"Invalid Entry!"
Me.Text26.SetFocus
End If



See More: If Statement in an If statement Access 2007

Report •


#1
September 1, 2010 at 07:01:45
Just an FYI...

We don't see a lot of Access VBA activity in this Forum. If you don't get an answer fairly soon, consider altering your Subject Line and text slightly and reposting in the Database forum. (An exact duplicate will probably get rejected)

DerbyDad03
Office Forum Moderator


Report •
Related Solutions


Ask Question