Button Visability

alastair69

Registered User.
Local time
Today, 05:38
Joined
Dec 21, 2004
Messages
562
Hello All,

I am have some problems obtaining a buttons status to be Enabled.false, i am using the following code but for some reason it will not work.

Private Sub Form_Current()
If Me.Email = Null Then
Me.cmdEmail.Enabled = False
Me.Refresh
End If

End Sub

Then button should only be unenabled in there is no e-mail address in the me.emailed text box.

Any help would be great.

Alastair

UPDATE:
*********************************** Resolved Thanks To Brian *********************************
 
Last edited:
I can't remember the syntax but don't you have to use IsNull, something like If Isnull(expression)

Brian
 
I have tried the following:
Private Sub Form_Current()
If Me.Email = IsNull(Me.Email) Then
Me.cmdEmail.Enabled = False
Me.Refresh
End If

End Sub

This does not work either, i am at a loss normally it would work.

Alastair
 
I Have do it WOW:

Code should be:
**********************************************************
Private Sub Form_Current()
If IsNull(Me.Email) Then
Me.cmdEmail.Enabled = False
Else
Me.cmdEmail.Enabled = True

Me.Refresh
End If

End Sub
**********************************************************

Thank you Brian

Alastair
 
Null

You may also want to use the trim statement here since many an Access programmer have pulled their hair out with blank fields......


If IsNull(trim((Me.Email)) Then
Me.cmdEmail.Enabled = False
Else
Me.cmdEmail.Enabled = True

Me.Refresh
End If
 
Are you sure that trimming a space out will return a null rather than an empty string ""?

Peter
 

Users who are viewing this thread

Back
Top Bottom