|
|
Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
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
|
|
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)
-- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no private e-mails, please)
"DS" <bootybox[ at ]optonline.net> wrote in message news:u6BKg.300$pN.292[ at ]newsfe12.lga...
[Quoted Text] >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
|
|
DS wrote:
[Quoted Text] > 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.
-- Rick Brandt, Microsoft Access MVP Email (as appropriate) to... RBrandt at Hunter dot com
|
|
Douglas J. Steele wrote:
[Quoted Text] > 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
|
|
Rick Brandt wrote:
[Quoted Text] > DS wrote: > >>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. >
Excellent, Just what I needed. thanks DS
|
|
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.
--
Terry Kreft
"Rick Brandt" <rickbrandt2[ at ]hotmail.com> wrote in message news:1gBKg.23513$gY6.17062[ at ]newssvr11.news.prodigy.com...
[Quoted Text] > DS wrote: > > 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. > > -- > Rick Brandt, Microsoft Access MVP > Email (as appropriate) to... > RBrandt at Hunter dot com > >
|
|
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.
--
Terry Kreft
"DS" <bootybox[ at ]optonline.net> wrote in message news:u6BKg.300$pN.292[ at ]newsfe12.lga...
[Quoted Text] > 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
|
|
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
DS wrote:
[Quoted Text] > 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
|
|
|