Re: How to reset global variables to nothing

From: Paul (paul_mak_at_hotmail.com)
Date: 11/09/04


Date: Mon, 8 Nov 2004 23:19:59 -0800

How about if the variable is the "date" type??

"Allen Browne" <AllenBrowne@SeeSig.Invalid> wrote in message
news:OtoLVvixEHA.3668@tk2msftngp13.phx.gbl...
> Unlike some languages, VB/VBA sets the initial value of the variable when
> you declare it. Therefore the way to reset it depends on its type.
>
> For numeric types (Integer, Long, Double, Currency, etc), just assign a
> zero:
> MyGlobal = 0
>
> For String types, assign a zero-length string:
> MyGlobal = vbNullString
>
> For Variants, assign the value Empty:
> MyGlobal = Empty
>
> For objects (Form, Control, TextBox, Recordset, etc), set to Nothing:
> Set MyGlobal = Nothing
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia.
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "Paul" <paul_mak@hotmail.com> wrote in message
> news:%23HBB0ZixEHA.3164@TK2MSFTNGP10.phx.gbl...
>> In a form I store the value of the text box to the global variables in a
>> module. At some point I need to reset those variables in the module to
>> nothing. So I tried the following code in the form event, Set
>> GlobalVariable.Text1 = Nothing or GlobalVariable = vbNullString and both
>> does not work. Thanks.
>
>



Relevant Pages

  • Re: Argh, lost two notebook drives !!!!!
    ... containing the 100GB hard disk was empty (the drive would be ... between the foam packaging) so I think she threw it away because ... I don't know the hard drive password the drive is unusable? ... reset the drive and it's like nothing was ever written to it. ...
    (alt.sys.pc-clone.dell)
  • Re: How to delete table contents and reset autonumber counters
    ... Simplest way is to compact the database after deleting all records. ... packs for Office and JET, ... rather than allenbrowne at mvps dot org. ... > number counters are not reset. ...
    (microsoft.public.access.tablesdbdesign)
  • Re: Whats wrong with this expression?
    ... "Allen Browne" wrote in message ... > Empty is the value that a Variant is initialized to. ... > Guess Types must be receiving its value from an unassigned variant. ... rather than allenbrowne at mvps dot org. ...
    (microsoft.public.access.reports)
  • Re: Refilling HP-02/C8771 Cartridges - HP Photosmart D7460
    ... When they indicate empty, you are supposed to pull them out, ... I've tried everything and can't get a reset. ... the printer software on the PC does the reset, ...
    (comp.periphs.printers)
  • Re: Lost All Newsgroups/Error Message
    ... communications between Outlook Express and your news server. ... IE has nothing to do with newsgroups. ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)

Loading