Enabling button based on text field

Del_Piero_3

Registered User.
Local time
Today, 15:52
Joined
Jul 20, 2004
Messages
33
Hi guys, just registered, very nice with excellent info forum you have here.

I aint that good with databases but am getting there slowly :) I have a problem, was wondering if you guys can help?

Here is the prob:

I have a button called openSubFrmPanelMembers that loads up a form when it is clicked based on whatever the value is in panelName field. I want this button to be disabled all the time if the value is Null in panelName otherwise its enabled. I hope I make sense :)

Below is the code I've tried but its not 100%, can any of you guys help me out. Many thanx, your help is much appreciated.

Private Sub panelName_AfterUpdate()

If Not IsNull(panelName) Then
openSubFrmPanelMembers.Enabled = True

ElseIf IsNull(panelName) Then
openSubFrmPanelMembers.Enabled = False

End If
End Sub
 
Try putting it in the "OnChange" event.
 
ReAn said:
Try putting it in the "OnChange" event.

Didnt work, the button stays disabled all the time.
 
Try:
Code:
If panelName = "" Then
...
Else
...
End If
 
Its ok guys, I solved it :) Thanx anyway

Solution:

Private Sub panelName_AfterUpdate()

If Not IsNull(Me.panelName.Value) Then
Me.openSubFrmPanelMembers.Enabled = True
Else
Me.openSubFrmPanelMembers.Enabled = False
End If

End Sub

Private Sub Form_Current()
If Not IsNull(Me.panelName.Value) Then
Me.openSubFrmPanelMembers.Enabled = True
Else
Me.openSubFrmPanelMembers.Enabled = False
End If

End Sub
 

Users who are viewing this thread

Back
Top Bottom