Mar 26th, 2002, 05:08 PM
#1
Thread Starter
Lively Member
IsNull and <>""
Is there a shorter expression that brings the same result as "IsNull(ctrl.Value) Or Len(Trim(ctrl.Value)) = 0"?
For example:
Code:
If IsNull(ctrl.Value) Or Len(Trim(ctrl.Value)) = 0 Then
str = "nuthin here"
End If
' equals
If ???? Then
str = "nuthin here"
End If
Matt(+)
Mar 26th, 2002, 05:14 PM
#2
What about just
If Len(Trim(ctrl.value))<1 then
'nothing here
End if
Need to re-register ASP.NET?
C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i
(Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)
Mar 26th, 2002, 05:17 PM
#3
-= B u g S l a y e r =-
don't think Trim on Null vlues will work Lord_Rat
Mar 26th, 2002, 05:18 PM
#4
Thread Starter
Lively Member
That doesn't work for null values
Len(Trim(Null)) = Null
Null < 1 = Null '<--type mismatch
Mar 26th, 2002, 05:19 PM
#5
Admittedly, I didn't try it this time.
Let me give it a whirl.
Need to re-register ASP.NET?
C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i
(Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)
Mar 26th, 2002, 05:20 PM
#6
-= B u g S l a y e r =-
mattalexx, I think the way u do it is it...
Mar 26th, 2002, 05:22 PM
#7
What kind of control?
Using a text box, Trim works fine, as in the attached.
Attached Files
Need to re-register ASP.NET?
C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i
(Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)
Mar 26th, 2002, 05:44 PM
#8
Thread Starter
Lively Member
I'm running this function for fields in a DAO recordset.
Mar 26th, 2002, 05:51 PM
#9
Member
what about
If (IsNull(ctrl.Value)) Or (ctrl.Value) = "") Then
'Nothing is there
End If
That'll work if the data is going to be a text or a number
I ain't the best coder,
I ain't the worst coder
Messanger Handle : FBz
Mar 27th, 2002, 12:18 PM
#10
Thread Starter
Lively Member
That's essentially the same as what I proposed in the beginning, isn't it?
Matt(+)
Mar 27th, 2002, 12:35 PM
#11
Ah, on a recordset
VB Code:
If Len(Value & "") = 0 Then
'Nuthin there
End If
The definition for Null as it applies to VB is not the same definition for null as it applies to a recordset. IsNull() isn't 100% effective in this case, but the preceeding code hasn't failed me yet.
Mar 27th, 2002, 12:41 PM
#12
Hey Waldo...
Waldo: Just for fun, how many times have you answered this one in the furums yet?
Mar 27th, 2002, 12:43 PM
#13
Ummm, how many posts do I have?
Mar 27th, 2002, 12:44 PM
#14
Thread Starter
Lively Member
I'm sorry, but sometimes the simplest problems are the hardest to find answers to.
Thank you very much for your help, Waldo, it is much appreciated.
Matt(+)
Mar 27th, 2002, 12:46 PM
#15
Hey, don't be sorry
I'm just glad I could help.
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width