Button to Enable Text Field

justinpatters

Registered User.
Local time
Today, 01:17
Joined
Aug 10, 2015
Messages
10
Hello!

I have a very simple question that I cannot locate an answer to:

I have all of my text fields disabled and I want the user to press a button to make them enabled. Seems simple enough.

So for instance, I have a field that links to the database called, "lastName"

Under the button's clicked property, I have coded,

Private Sub Command44_Click()

lastName.Enabled = true

End Sub


I'm not getting any errors, no matter what I code.

Can anyone help with this?
 
Let's try...

Code:
 Private Sub Command44_Click()

Me.lastName.Enabled = true

End Sub
 
Let's try...

Code:
 Private Sub Command44_Click()

Me.lastName.Enabled = true

End Sub


Thanks for the response...but that doesn't seem to work. I'm not sure if the code is just not going hand in hand with the database or what. Any ideas?
 
Have you checked that the code does actually fire.
Also, perhaps you also need to unlock the control?

Me.lastName.Locked= False
 
Hmm, what is the name of the Control on the Form? (Not the Control Source)
 
Hmm, what is the name of the Control on the Form? (Not the Control Source)

I located the Control Source, but not the Control for the Form. Where would I locate that? Sorry, I program in Javascript and new to Access.
 
In Design View of the Form bring up the Properties window. Click on the Control and the name of will appear in the Properties window. That is the name that should be within the line of code not the Control Source.
 
In Design View of the Form bring up the Properties window. Click on the Control and the name of will appear in the Properties window. That is the name that should be within the line of code not the Control Source.

I changed the name to lastNameField and edited the code...still nothing. Is there a way to write a simple print statement for the debugger? It's like the code isn't even being attempted. Shouldn't I get an error if it's wrong?
 
I changed the name to lastNameField and edited the code...still nothing. Is there a way to write a simple print statement for the debugger? It's like the code isn't even being attempted. Shouldn't I get an error if it's wrong?
So did you check that the code fires at runtime as I suggested in post #4
 
Put this within the code block...

Code:
MsgBox "Yep, I'm working"
 
Put this within the code block...

Code:
MsgBox "Yep, I'm working"

This is what I entered:

Code:
Private Sub Command44_Click()

    MsgBox "Yep, I'm working"

End Sub

It produces nothing upon a button click. I have no idea why it isn't working. I'm saving after each edit, too. Also, thanks so much for your help GinaWhipp!
 
Put this within the code block...

Code:
MsgBox "Yep, I'm working"

Never mind! I got it...apparently the MACROS were giving my system a security risk...so...I enabled all of those and it's running fine now. Thanks so much for your help!
 

Users who are viewing this thread

Back
Top Bottom