Validation Problem

D

Dot.FT

Hi
I have a table that contains users' Passwords and Role codes
Users need to access certain forms depending on the Role Code entered in
txtRCode textbox.
For example:
- If table field RoleCodeT = "T" user has no access to Form Admin.
- If table field RoCodeD = "D" user has access to Form Develop.
- If table field RoleCodeA = "A" user has access to Form Admin.

Password validation is working fine. However, the role code validation is
not correct.
I store and validate for either "A" or "D" as follows:

If txtRCode = "A" Then
strRoleCodeAdminIn = "A"
strRoleCodeAdmin = Nz(DLookup("Role_CodeAdmin", "AccStaff", "Role_CodeAdmin
= '" & txtRCode & "'"), "")
Exit Sub
End If

If txtCode = "D" Then
strRoleCodeDevIn = "D"
strRoleCodeDev = Nz(DLookup("Role_CodeDeveloper", "AccStaff",
"Role_CodeDeveloper = '" & txtRCode & "'"), "")
Exit Sub
End If

At the moment I can enter any char in textbox RoleCode and the user has
access. Any suggestions to validate if user entered A or D and it matches the
table entry then display the form accordingly?
Something like?
If strRoleCodeDev = strRoleCodedevIn And strUserName = txtUID And
strUserPWD = txtUPWD Then
' Open Main Menu
DoCmd.OpenForm "Administration Menu"


Thanks in advance,
Dot.FT
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top