Google
 
Webnews.only-4-geeks.com
Interesting places
news.only-4-geeks.com Forum Index » Access

VBA if textbox is null

 
Jump to:  
 
ghetto_banjo
PostPosted: Wed Sep 03, 2008 2:35 pm    Post subject: VBA if textbox is null
       
in VBA, i have an if statement checking to see if a text box is empty,
if it is i want to display a msgbox. seemingly not working if I use
Is Null, = Null, or = "". No default value on the textbox.

if me.text5 = "" then.....
This simply calculates the if statement as False when the text box is
empty.

if me.text5 is Null then...
This results in a Run-Time Error 424 Object Required on that line.

if me.text5 = Null then...
this once agains calculates if statement as False




what am i not seeing here....
 

 
fredg
PostPosted: Wed Sep 03, 2008 2:35 pm    Post subject: Re: VBA if textbox is null
       
On Wed, 3 Sep 2008 07:35:45 -0700 (PDT), ghetto_banjo wrote:

Quote:
in VBA, i have an if statement checking to see if a text box is empty,
if it is i want to display a msgbox. seemingly not working if I use
Is Null, = Null, or = "". No default value on the textbox.

if me.text5 = "" then.....
This simply calculates the if statement as False when the text box is
empty.

if me.text5 is Null then...
This results in a Run-Time Error 424 Object Required on that line.

if me.text5 = Null then...
this once agains calculates if statement as False

what am i not seeing here....
There is a difference between a field being Null and it containing a

zero length string, i.e. =""

Check for both.

If IsNull(Me![Text5]) Or Me![Text5] = "" Then
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
 

 
Dennis
PostPosted: Wed Sep 03, 2008 2:35 pm    Post subject: RE: VBA if textbox is null
       
if IsNull(me.text5) Or Me.text5="" then

"ghetto_banjo" wrote:

Quote:
in VBA, i have an if statement checking to see if a text box is empty,
if it is i want to display a msgbox. seemingly not working if I use
Is Null, = Null, or = "". No default value on the textbox.

if me.text5 = "" then.....
This simply calculates the if statement as False when the text box is
empty.

if me.text5 is Null then...
This results in a Run-Time Error 424 Object Required on that line.

if me.text5 = Null then...
this once agains calculates if statement as False




what am i not seeing here....
 

 
Jeff Boyce
PostPosted: Wed Sep 03, 2008 2:35 pm    Post subject: Re: VBA if textbox is null
       
It all starts with the data...

What data is supposed to be there? Is the textbox bound to a field in a
table?

Regards

Jeff Boyce
Microsoft Office/Access MVP


"ghetto_banjo" <adam.vogg@gmail.com> wrote in message
news:bbba1cf2-c11b-4146-9a7e-c81895ec065f@o40g2000prn.googlegroups.com...
Quote:
in VBA, i have an if statement checking to see if a text box is empty,
if it is i want to display a msgbox. seemingly not working if I use
Is Null, = Null, or = "". No default value on the textbox.

if me.text5 = "" then.....
This simply calculates the if statement as False when the text box is
empty.

if me.text5 is Null then...
This results in a Run-Time Error 424 Object Required on that line.

if me.text5 = Null then...
this once agains calculates if statement as False




what am i not seeing here....
 

 
ghetto_banjo
PostPosted: Wed Sep 03, 2008 2:57 pm    Post subject: Re: VBA if textbox is null
       
Thats it thanks.

i needed to do the IsNull(text) as opposed to text Is Null.




Thanks again!
 

Page 1 of 1 .:.

Google
 
Webnews.only-4-geeks.com

Windows Update | C++ | C | PHP | JavaScript | Photoshop | Programming | Windows 2000 | Python | Windows XP | Object | Flash | Flash - ActionScript | Paint Shop Pro | Excel | PowerPoint | Access | Word | Windows 98 | Internet Explorer 6.0 | CorelDraw12 | Java | XML | asm x86 | Linux Mandrake | Linux RedHat | Outlook |  | news from newsgroups |_ | s

Web Templates

Awesome Website Templates ©

hale namiotowe zdjęcia ślubne strony www Kraków shoutcast rolety