Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Not understand NULL

Posted on 1999-01-14
5
Medium Priority
?
182 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
  • 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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

824 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