UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Is Null And Not Is Null, Access 2010    
 
   
dzoker
post Jul 29 2020, 01:00 PM
Post#1



Posts: 483
Joined: 12-February 14



Hi all,

I have a simple code

CODE
If not IsNull(Me.Text223) And IsNull(Me.Text255) Then


What I'm trying to do is that I have the two textboxes on the form (223 & 255) and I'm trying to msgbox if Text223 is populated and Text255 is empty and go to else if not the case

When I debug and Text223 is empty I get nothing, when filled it gives me the value.

No matter if Text223 is empty or not, the code continues?


What am I doing wrong?
This post has been edited by dzoker: Jul 29 2020, 01:01 PM
Go to the top of the page
 
theDBguy
post Jul 29 2020, 01:04 PM
Post#2


UA Moderator
Posts: 78,614
Joined: 19-June 07
From: SunnySandyEggo


Hi. Did you try checking for an empty string (ZLS), just in case?

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
dzoker
post Jul 29 2020, 01:10 PM
Post#3



Posts: 483
Joined: 12-February 14



theDBGuy,

Of course not.. lol. How do I do that?
Go to the top of the page
 
theDBguy
post Jul 29 2020, 01:19 PM
Post#4


UA Moderator
Posts: 78,614
Joined: 19-June 07
From: SunnySandyEggo


Hi. By any of the following:

1. If Me.TextboxName="" Then

2. If Len(Me.TextboxName) = 0 Then

To check both Null and ZLS at the same time, you can try any of the following:

1. If Me.TextboxName & "" = "" Then

2. If Len(Me.TextboxName & "") = 0 Then

3. If Me.TextboxName > "" Then

4. If Nz(Me.TextboxName,"")="" Then

etc...

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
dzoker
post Jul 29 2020, 01:41 PM
Post#5



Posts: 483
Joined: 12-February 14



theDBguy,

I have no Idea why but this did it

CODE
If Len(Me.Text223 & "") > 1 And IsNull(Me.Text255) Then


Even though I set allow zero Lenght to No, I still show 1 on If Len(Me.Text223 & "") = 0
Go to the top of the page
 
theDBguy
post Jul 29 2020, 02:12 PM
Post#6


UA Moderator
Posts: 78,614
Joined: 19-June 07
From: SunnySandyEggo


Hi. A length of one (1) means it could be a space character. What do you get with this?

MsgBox Asc(Me.Text223)

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
dzoker
post Jul 29 2020, 02:44 PM
Post#7



Posts: 483
Joined: 12-February 14



theDBguy,

Yea, I have no idea how space gets there as it is a very simple form and everything else.

As far as MsgBox Asc(Me.Text223):

- If both are empty I get 32 (space)

- If Text223 is populated I get 86 (V) which is correct

But like I said, I have no idea where the space is coming from!!

Go to the top of the page
 
theDBguy
post Jul 29 2020, 03:46 PM
Post#8


UA Moderator
Posts: 78,614
Joined: 19-June 07
From: SunnySandyEggo


Well, at least we were able to verify you were getting a Space character. Now you know how to handle it. Cheers!

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
dzoker
post Jul 29 2020, 03:58 PM
Post#9



Posts: 483
Joined: 12-February 14



Thank you!
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    6th August 2020 - 07:52 AM