Query not combining and filtering values based on a form

You should use the second one, that is why I changed it.

I did not delete the other hidden fields until we are sure we are not going to use those.
 
Ok so this is an example of the On_Current event code in one of the forms:
Code:
On Error Resume Next
If Forms![frmAffiliateNameAndRegion]![txtSecurityID] = 9 Then
fncLockUnlockControls Me, True
Else
fncLockUnlockControls Me, False
End If
But when I check the txtSecurityID field (made it visible to check) it's blank? Any suggestions on what I did wrong?
 
The one on the Switchboard is blank? You did remove your name from tblUsers did you?
 
No, no this is on another form (frmAffiliateNameAndRegion). I was trying to apply the On_Current code to all the other forms and started with frmAffiliateNameAndRegion (no subform on it). But like I said the txtSecurityID field is blank. My name is still in the table with a 9.
On the switchboard it still shows 9, so that's good.
 
Right because as long as the Switchboard is open the code will work. Are you saying you close the Switchboard and then open the other Forms?
 
No the switchboard is still open when I open the other forms.
 
Then I don't understand why it's not working. If the 9 is showing on the Switchboard then it should find it. Or am I confused and the 9 is not showing on the Switchboard?
 
No, the 9 is showing on the switchboard when I open the other forms. Hmm... maybe I applied the code incorrectly (very possibly I did)? Would you like to take a look for me?
I've applied the code to most (not the hidden forms) in the db. I kept txtSecurityID visible to be able to check. It's not labeled but you should be able to spot the unmarked text box in the forms.
 

Attachments

Hmm, you changed it, the code must remain as...

Code:
On Error Resume Next
If Forms![Switchboard]![txtSecurityID] = 9 Then
   fncLockUnlockControls Me, True
Else
   fncLockUnlockControls Me, False
End If

The first line, it must find the Switchboard not the Form you are opening.
 
Oh jezz, I'm a dingbat. Sorry.
Changed the code in all the forms to what you have listed. But txtSecurityID is still blank? No #9.
 
I don't get it, it's not blank when I open it. Try Compact & Repair.
 
We're talking about other forms not the switchboard, right? bc the switchboard shows 9. But I'm talking about the other forms. They aren't showing anything in the txt box even after I compact and repair.
 
Yes, we are and the other Forms do not need to show anything, nor should they. The Code is only looking for the Switchboard.
 
Ooohhhh! Okay. This whole time I thought the other forms needed to show 9 as well :o
I'm a little concerned as to why I'm still able to alter anything on a form (delete/add fields). My SecurityID is set to 9.
 
So am I because when I tried I couldn't. Did you check the table to see if your name is in there twice?
 
Yes it's in there twice. Same name but one from work and one from home computer. Does that make a difference? Should I delete one? Both are set to 9.
 
Just deleted one of the entries. Didn't make a difference, I can still alter any of the forms.
 
Why are you sooo special? When I do it I can't even make a selection from a Combo Box. Wait, are you using the buttons? The code can't lock Command Buttons.
 
When I do it I can't even make a selection from a Combo Box. Wait, are you using the buttons? The code can't lock Command Buttons.
I don't understand what you mean by this?
Actually, wait a minute now that I try, I can't make any entry in any of the forms?! Or make a selection from a combo box or make any entry in a text box. But when I change my SecurityID to 2 I can make entries! Cool! So I guess that part works. But I when I set my ID at 9 I can't make any entry but I can still alter the forms. Meaning I can go in design view and move things, delete things or add things to the form.

What's the difference between 2-read/write and 13-ADMIN?
 

Users who are viewing this thread

Back
Top Bottom