473,379 Members | 1,252 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Help wanted Code won't work

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
5 1817
> 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
"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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jim | last post by:
Hey guys I DESPERATLY need some help with this small javascript i have on this website. All that it's supposed to do is change the button image once it's pressed but alas... I copy-pasted the code...
39
by: gtippery | last post by:
Newbie-ish questions - I've been away from C for a _long_ time. It seems to me that there ought to be easier (or at least shorter) ways to do what this does. It does compile & run for me (with...
22
by: Jeff Louie | last post by:
Well I wonder if my old brain can handle threading. Dose this code look reasonable. Regards, Jeff using System; using System.Diagnostics; using System.IO; using System.Threading;
6
by: J | last post by:
Kind of new at programming/vb.net. I'm doing this junky die roller program. Heres's what is supposed to happen: Roll 2 6-sided dies. Add rolls together put total in rolls(d6total). Display...
36
by: felixnielsen | last post by:
What i really wanna do, is defining my own types, it doesnt really matter why. Anyway, i have run into some problems 1) typedef unsigned short U16; U16 test = 0xffffffff; // There should be a...
6
by: AppleBag | last post by:
I'm having the worst time trying to login to myspace through code. Can someone tell me how to do this? Please try it yourself before replying, only because I have asked this a couple of times in...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
5
by: giddy | last post by:
Hi , I'm probably just doing something a little silly. I get a System.Configuration.ConfigurationErrorsException! This is my config file: <configSections> <section name="qConfig"...
5
by: weidongtom | last post by:
Hi, I tried to implement the Universal Machine as described in http://www.boundvariable.org/task.shtml, and I managed to get one implemented (After looking at what other's have done.) But when I...
5
by: dm3281 | last post by:
I'm really starting to hate writing services -- or trying to, anyway. Why do I need to rename my project to the service name? Why do I need to set the "ServiceName" property to my service name?...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.