View Full Version : Greying out buttons


junmart
09-14-2001, 09:26 AM
i am able to grey out(disable) a command button when textbox1 is empty. but how can i enable the command button once a user enters info in textbox1? this is the code i use:

Private Sub Form_Current()
If IsNull(Me.Text25) Then
Command27.Enabled = False
Else
Command27.Enabled = True
End If
Me.Refresh
End Sub

what else do i need to add? thanks!!

Chris RR
09-14-2001, 10:01 AM
Put your code to enable the button into the after update event for textbox1. I don't think that you need to do the me.refresh, but that's a guess.

By the way, let me make a pitch here for renaming your fields and buttons. It's a lot easier to follow code (even your own, a few months later), if you are working with something called txtHomePhone, not Text117, or btnCalcTax, not Command15...

junmart
09-14-2001, 12:09 PM
thanks a lot! i will follow your advice including naming controls.... thanks again!