Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Not understand NULL

Posted on 1999-01-14
5
Medium Priority
?
176 Views
Last Modified: 2010-05-03
1. A help file said that var1 in IsNull(var1) should be a Variant type variable, but in an exmaple var1 is a textbox name.  var1 can be what type?
2. If var1 is a txtbox name, or other object name, what means by IsNull(var1) = True?
3. Can we assign Null to a variable other than the ones of Variant type?
0
Comment
Question by:learn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 3

Accepted Solution

by:
traygreen earned 150 total points
ID: 1456303
1) VB will typecast the variable to Variant - so string etc are valid parameters
2)if you pass the name in as parameter var1 and it is null then will return true
3)Typically no.  You have to assign an empty string to a string not null, nor can you assign it to numeric types
0
 
LVL 10

Expert Comment

by:caraf_g
ID: 1456304
1 the reason why the parameter in IsNull is a variant is because you can put in any type of variable - string, integer etcetera.
2 hard to say - if, for example, the data is retrieved from a database using SQL, it means that the contents of the field in the database was NULL.
3 No
0
 
LVL 3

Expert Comment

by:traygreen
ID: 1456305
Sorry the answer #2 is incorrect - It will return false
Basically Null is returned when a variable pointer does not address memory.
In other languages you would use it (or nil) to destroy the address link between a variable and it's memory location.  
0
 

Author Comment

by:learn
ID: 1456306
So you, experts, said
a) we can put any type as the parameter in IsNull(), VB take care of turnning them to Variant;
b) we can not assign Null to any type except Variant.
am I right?

I remember I wrote a code
    Dim s As String
    Print IsNull(s)
and got error message: using Null incurrect....
I will check this code again later.

Thanks a lot
0
 

Author Comment

by:learn
ID: 1456307
Sorry, we should not get any error in the last code.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question