|  | VBA if textbox is null |  | |
| | | ghetto_banjo |  |
| Posted: 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 |  |
| Posted: 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 |  |
| Posted: 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 |  |
| Posted: 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 |  |
| Posted: 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! |
| |
|
|