Releasing Variables

D

DS

I know noe that release a String Variable without closing a form the
synax is:
strA = ""
But how dou you clear the other types variables?
Like Date, Long, Integer etc...
Thanks
DS
 
D

Douglas J. Steele

What do you mean by "release"?

Numeric fields can only take numeric values. If you declare a variable as
numeric and don't assign it a value, by default its value will be 0. Is that
what you want?

Date fields are actually numeric fields under the covers, so they get set to
0 by default as well (which corresponds to midnight on 30 Dec, 1899)
 
R

Rick Brandt

DS said:
I know noe that release a String Variable without closing a form the
synax is:
strA = ""
But how dou you clear the other types variables?
Like Date, Long, Integer etc...
Thanks
DS

You cannot release any variable other than a variant. It might seem like
setting a text variable to "" is releasing it, but you are just setting it to
its default value. All variables other than variants contain the default value
for their type the moment they are dimmed. These are...

String ""
Date #12/30/1899 00:00:00#
All Numeric 0

So, if your definition of "releasing" a variable is to reset it to its default
value then the above are what you would set them to.
 
D

DS

Douglas said:
What do you mean by "release"?

Numeric fields can only take numeric values. If you declare a variable as
numeric and don't assign it a value, by default its value will be 0. Is that
what you want?

Date fields are actually numeric fields under the covers, so they get set to
0 by default as well (which corresponds to midnight on 30 Dec, 1899)
Ok...I mean to clear out, make empty, null or zero. Bring it back to
it's original state before you sent a value to it.
Thanks
DS
 
D

DS

Rick said:
You cannot release any variable other than a variant. It might seem like
setting a text variable to "" is releasing it, but you are just setting it to
its default value. All variables other than variants contain the default value
for their type the moment they are dimmed. These are...

String ""
Date #12/30/1899 00:00:00#
All Numeric 0

So, if your definition of "releasing" a variable is to reset it to its default
value then the above are what you would set them to.
Excellent, Just what I needed.
thanks
DS
 
T

Terry Kreft

If you want to set a date variable back to it's default value you can just
let it be 0.

Why anyone would bother though is beyond me, unless they're improperly using
global vars of course.
 
T

Terry Kreft

There is no technical need to do this, the only variables you need to
release are those which are acting as a pointer to an object.
 
N

Nick 'The database Guy'

There is no need to release variables unless they are object variables,
in which case you would use the syntax:

Set ObjectVariable = Nothing

Good Luck

Nick
 
Top