Query not combining and filtering values based on a form

Just did, on the Switchboard, and I was able to change the layout. I have a securityID of 9 which is Read only.
 
Wait your Switchboard has subforms? Also make sure that hidden field txtSecurityID is showing 9.
 
Yes the switchboard has a subform but I tried to change the main form.
Do you mean make sure in the tblUsers that the uSecurityID field is showing 9? In that case yes it is.
 
No, on the Switchboard you added those 5 fields, well, we took a couple away but you should see a 9 showing in one of them. Are you saying nothing is showing?
 
Hidden in the switchboard I have txtSecurityID, txtOverride, txtUserID and txtPassword. I'm not sure where I would see a 9. In design view for txtSecurityID it says unbound.
 
Make txtSecurityID visible so you can see does the 9 show.
 
Then something is wrong because you should see a 9. I'll look at the sample you sent earlier.
 
Oops, you should see a 2, I see you changed the numbers and it works in the last sample you uploaded, so what did you change?
 
Maybe when I first made the table I just put in the values and didn't think about the numbers. But since then I have changed the table to look exactly the way you have yours. 2 for Read/Write, 9 for Read only and 13 for ADMIN.
But that's weird bc now I just tried opening the db and I see a 9 in the text box?:confused: But I can still change any part of the form.
 
Yes. This is what I have for the code:
Code:
Private Sub Form_Current()
On Error Resume Next

     If Forms![Switchboard]![txtSecurityID] = 9 Then
       fncLockUnlockControls Me, True
     Else
       fncLockUnlockControls Me, False
     End If

End Sub


Private Sub Switchboard_Current()
On Error Resume Next

     If Forms![Switchboard]![txtSecurityID] <> 13 And Forms![Switchboard]![txtOverride] = False Then
       fncLockUnlockControls Me, True
     Else
       fncLockUnlockControls Me, False
     End If
End Sub
 
This is useless, so remove it and try again...

Code:
Private Sub Switchboard_Current()
On Error Resume Next

If Forms![Switchboard]![txtSecurityID] <> 13 And Forms![Switchboard]![txtOverride] = False Then
fncLockUnlockControls Me, True
Else
fncLockUnlockControls Me, False
End If
End Sub
 
I'm really sorry. I thought I was to copy the whole piece of code. I didn't know I was only to copy the bottom part. I'm sorry.
I put in the code you just gave me. But it still lets me alter the form. I must me doing something wrong. I'm sorry to be causing you so much trouble. Thank you for helping me. I've attached my current copy just in case you would like to take a look at it.
 

Attachments

I'm still able to alter the form. Am I doing something wrong?
 
What is it you are altering? What is your Security ID in tblUsers
 
I was trying to alter the design of the form, move things, delete things. My SecurityID is 9 in the table and 9 is showing in the text box. (Which reminds me would I also need to put those 4 hidden text boxes in every form I put the code in?)
 
So this is the code that I put in the On_Current event in all my forms that I want to apply permissions to:

Code:
Private Sub Switchboard_Current()
On Error Resume Next
If Forms![Switchboard]![txtSecurityID] <> 13 And Forms![Switchboard]![txtOverride] = False Then
fncLockUnlockControls Me, True
Else
fncLockUnlockControls Me, False
End If
End Sub
But with the different form names?
And not this part?:
Code:
Private Sub Form_Current()
On Error Resume Next
     If Forms![Switchboard]![txtSecurityID] = 9 Then
       fncLockUnlockControls Me, True
     Else
       fncLockUnlockControls Me, False
     End If
End Sub
Also, do I need to put all 4 hidden txt fields on the forms as well?
 

Users who are viewing this thread

Back
Top Bottom