Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to enabled a textfield after clickin a button on a form?

Status
Not open for further replies.

jonra

Programmer
Jul 20, 2003
42
SG
when i open the form,as i dun wan user to be able to enter anything at first i disable the button.i wan to enable the buttons after i click on a button.how can i do it???can u guys pls help...thanks!
 
Let me get this straight

you have 2 buttons on a form, lets say command1 is not enabled when the form loads,

you want it to be enabled when the user presses another button lets call it command2.

if the above is what you are trying to achieve

then in the on click event of command2 place the following code.

me.command1.enabled = true

where command1 is the name of the command button you wish to enable.

Hope this helps

Idd
 
Don't disable the button using it's right click enabled property, make sure it is enabled. Instead on the FORM Open event, put an Event procedure:

Private Sub Form_Open(Cancel As Integer)
Me.button1.enabled = false
End Sub

Then using the ON CLICK event for the second button put in another event procedure stating ME.Button1.enabled = true

So your second button ON CLick event procedure should look like this:

Private Sub button2_Click()
On Error GoTo Err_button2_Click
me.button1.enabled = true
Exit_button2_Click:
Exit Sub

Err_button2_Click:
MsgBox Error$
Resume Exit_button2_Click
End Sub

Even better, if you want the button1 to be disabled for all records in the form until button2 is clicked each time then move the Me.button1.enabled = false statement out of the FORM open event and put it into an event procedure under the ON CURRENT form property
 
thanks guys...i will try it out...im sure it can work...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top