coding on Current

Hi Experts,
I'm having trouble to figure what I did wrong that one set of the coding is not working.  I need another pair of eyes to look at it.  Thanks
here are the code.  They both are check box (true/false ).  

 If Me.CPPETITIONER = True Then
     Me.CPNCTANF.Locked = True
     If stSecurity < 5 Then
        Me.CPPETITIONER.Locked = True
     Else
        Me.CPPETITIONER.Locked = False
     End If
  Else
     Me.CPNCTANF.Locked = False
  End If
 the above code is not working because after I checked the check box, exist out and I still can uncheck the check box (I'm currently stSecurity = 1)


  If Me.CPNCTANF = True Then
     Me.CPPETITIONER.Locked = True
     If stSecurity < 5 Then
        Me.CPNCTANF.Locked = True
     Else
        Me.CPNCTANF.Locked = False
     End If
  Else
     Me.CPPETITIONER.Locked = False
  End If

thanks
urjudoAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dale FyeOwner, Developing Solutions LLCCommented:
You will probably have to call that code in both the Current event, and in the click event of CPPetitioner.
urjudoAuthor Commented:
you mean after update in CPPetitioner?
Dale FyeOwner, Developing Solutions LLCCommented:
if CPPetitioner is a checkbox, I prefer to use the Click Event,  something like:

Private sub CPPetitioner_Click

    Call Form_Current

End Sub

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Acronis True Image 2019 just released!

Create a reliable backup. Make sure you always have dependable copies of your data so you can restore your entire system or individual files.

urjudoAuthor Commented:
I tired both code on both after update, it still not working.
urjudoAuthor Commented:
I just tried it again on the on click event, still not working.
Jeffrey CoachmanMIS LiasonCommented:
Please clearly define "Not Working"

You, may also have to define your IF logic to us in plain English, ...I cant follow it...?
after I checked the check box, exist out
"exist out"  ?

...or post a sample db and explain in detail what you are trying to accomplish...

What the bottom code there for?... is it relevant to the question about the first snippet?

Always strive to  keep this simple at first, and test each condition individually.
...then add your conditions one at a time.
This way you are only troubleshooting the last condition you added, ....not the entire code snippet...
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.