By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,466 Members | 2,497 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,466 IT Pros & Developers. It's quick & easy.

Help wanted Code won't work

P: n/a
Bob
Hi Everybody

I think I have lost a few brain cells tonight.

Can anyone see why this doesn't work. I have tried it all ways

Private Sub Form_Current()

If Me!MemoWrite Is Null Then
Me!CmdEmail.Visible = False

End Sub

Where CmdEmail is a command button that I want to be invisble when the Memo field
MemoWrite has no content.

Thanks

It is now 1 o clock in the morning. I'm gonna sleep on it. Wifey doesn't sound to happy:-)

Smiley Bob
Nov 12 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
> If Me!MemoWrite Is Null Then
Me!CmdEmail.Visible = False


Here are two approaches:

If IsNull(Me!MemoWrite) Then

.... and, to accommodate possible zero-length strings or spaces ...

If Len(Trim(Me!MemoWrite) & vbNullString) = 0 Then

--
Bruce M. Thompson, Microsoft Access MVP
bt******@mvps.org (See the Access FAQ at http://www.mvps.org/access)
NO Email Please. Keep all communications

within the newsgroups so that all might benefit.<<
Nov 12 '05 #2

P: n/a
"Bob" wrote
Can anyone see why this doesn't work.
I have tried it all ways

Private Sub Form_Current()

If Me!MemoWrite Is Null Then
Me!CmdEmail.Visible = False

End Sub


The test for Null would be

If IsNull(Me!MemoWrite) Then
Me!cmdEmail.Visible = False
End If

An If statement that extends to two lines needs an EndIf. You should be
getting a compile or an execution error, unless that was an omission in
transferring the statements.

The "Is Null" you used works in the criteria of Queries, but in code you
have to use the builtin IsNull function. You may also want to test for that
TextBox having a value of "" (the zero-length-string, which it might have
undersome circumstances of entering and clearing data).

It always helps if you describe what indicates that it didn't work -- just
the absence of the action, or an error message, or ???.

Larry Linson
Microsoft Access MVP

Nov 12 '05 #3

P: n/a
Bob
On Tue, 20 Apr 2004 00:58:59 GMT, "Larry Linson" <bo*****@localhost.not> wrote:
"Bob" wrote
Can anyone see why this doesn't work.
I have tried it all ways

Private Sub Form_Current()

If Me!MemoWrite Is Null Then
Me!CmdEmail.Visible = False

End Sub
The test for Null would be

If IsNull(Me!MemoWrite) Then
Me!cmdEmail.Visible = False
End If

An If statement that extends to two lines needs an EndIf. You should be
getting a compile or an execution error, unless that was an omission in
transferring the statements.


Yes there was
The "Is Null" you used works in the criteria of Queries, but in code you
have to use the builtin IsNull function. You may also want to test for that
TextBox having a value of "" (the zero-length-string, which it might have
undersome circumstances of entering and clearing data).

It always helps if you describe what indicates that it didn't work -- just
the absence of the action, or an error message, or ???.

Larry Linson
Microsoft Access MVP
Thanks Larry. Thats got me back on track.


Nov 12 '05 #4

P: n/a
Bob
On Mon, 19 Apr 2004 20:53:49 -0400, "Bruce M. Thompson" <bthmpson@big_NOSPAM_foot.com> wrote:
If Me!MemoWrite Is Null Then
Me!CmdEmail.Visible = False


Here are two approaches:

If IsNull(Me!MemoWrite) Then

... and, to accommodate possible zero-length strings or spaces ...

If Len(Trim(Me!MemoWrite) & vbNullString) = 0 Then

Thanks Bruce.

This one worked best for me.

Reagrds Bob
Nov 12 '05 #5

P: n/a
Just to be contrary (No If statement required)

With Me
.CmdEmail.Visible = (Len(Trim(.MemoWrite & "")) > 0)
End With
--
Terry Kreft
MVP Microsoft Access
"Bob" <sm*******@hotmail.com> wrote in message
news:ru********************************@4ax.com...
Hi Everybody

I think I have lost a few brain cells tonight.

Can anyone see why this doesn't work. I have tried it all ways

Private Sub Form_Current()

If Me!MemoWrite Is Null Then
Me!CmdEmail.Visible = False

End Sub

Where CmdEmail is a command button that I want to be invisble when the Memo field MemoWrite has no content.

Thanks

It is now 1 o clock in the morning. I'm gonna sleep on it. Wifey doesn't sound to happy:-)
Smiley Bob

Nov 12 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.