Results 1 to 5 of 5
  1. #1
    orcinus is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Apr 2010
    Posts
    67

    How to Set an Integer to Nothing


    Would like to know if its possible to set an integer type variable to nothing. If not, then in order to free up the memory and rid that variable of any values it might currently have, how do I do this?

    Note: I tried:

    int_var = nothing

    Set int_var = nothing

    to no avail.

    I did think of setting it to zero (0) but was then thinking that the variable still holds a value even it the value is zero?

    Thanks for any help with conceptual and syntax help on this..

  2. #2
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    sir,

    if you want the truth, unless you have a 1GB size or bigger db, this is not really even important from a memory-saving prospective.

    Not IMO, anyway. What is your reasoning for this?

  3. #3
    orcinus is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Apr 2010
    Posts
    67
    Quote Originally Posted by ajetrumpet View Post
    sir,

    if you want the truth, unless you have a 1GB size or bigger db, this is not really even important from a memory-saving prospective.

    Not IMO, anyway. What is your reasoning for this?
    I've heard that it good to reset variables so that when they have completed their raison d'etre for any given session, it is good to set their values to be nothing, or empty.

    However, what I'm not clear on the scope of the variables this applies to. What I've seen is that people almost always set a variable to 'nothing' that is (I believe) an object(?) variable. So when a recordset has completed its programming mission (for a given run), in the code, they set this variable back to nothing or empty(?)

    Though, again, I'm not sure the scope. So, does this reasoning apply to string variables? Integer variables? etc..And if it does, does each variable or set of variables have its own "nothing" setting that you set it back to after its completed its purpose?

    So, thinking about this some more, maybe upon completing their function, these variables need to reset to their value they had upon being Dim'd?

    So, I checked the String and Integer variables after being Dim'd but before any value is assigned and the String variable shows "" and the Integer value shows 0.

    Is this the answer to my question? It seems so..

    Thanks..

  4. #4
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    OK...I only read the first 2 sentences of your last post. So for that, check this out: http://www.mrexcel.com/forum/showthread.php?t=14195

    what he's saying is true. numbers reset to 0. you cannot empty them or set them, to my knowledge anyway.

    but again you're back to the purpose of why you're doing it. for instance, if you're getting a project done quickly, this should be of little concern. It usually is to me anyway, as most customers want things quickly.

    as far as the standard for doing this sort of stuff, see the last line of the above post. also, check out: www.cpearson.com

    Chip Pearson discusses this stuff somewhere on his site. He's an extremely intelligent person, but a lot of his stuff is advanced, so if you're somewhat of a novice, the site's content may be confusing at times.

  5. #5
    orcinus is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Apr 2010
    Posts
    67
    Quote Originally Posted by ajetrumpet View Post
    OK...I only read the first 2 sentences of your last post. So for that, check this out: http://www.mrexcel.com/forum/showthread.php?t=14195

    what he's saying is true. numbers reset to 0. you cannot empty them or set them, to my knowledge anyway.

    but again you're back to the purpose of why you're doing it. for instance, if you're getting a project done quickly, this should be of little concern. It usually is to me anyway, as most customers want things quickly.

    as far as the standard for doing this sort of stuff, see the last line of the above post. also, check out: www.cpearson.com

    Chip Pearson discusses this stuff somewhere on his site. He's an extremely intelligent person, but a lot of his stuff is advanced, so if you're somewhat of a novice, the site's content may be confusing at times.
    I'm a "variable frequency" user. Some stuff I know is fairly advanced, other more simple stuff I don't know. Characteristic of being self taught and not starting from any particular "beginning".

    So for me its hit and miss..but after reading this, I'm a bit more 'hit' on this particular subject..

    Thanks for the links and thoughts..

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Integer not incrementing
    By jgelpi16 in forum Programming
    Replies: 2
    Last Post: 01-31-2011, 02:40 PM
  2. Adding column as INTEGER makes it a long integer?
    By luckycharms in forum Programming
    Replies: 2
    Last Post: 10-20-2010, 02:47 PM
  3. creating records from integer range in a form
    By archzealot in forum Forms
    Replies: 8
    Last Post: 04-05-2010, 12:45 AM
  4. How to ADD integer (vba)
    By Computer202 in forum Programming
    Replies: 24
    Last Post: 03-13-2010, 08:50 AM
  5. Replies: 1
    Last Post: 06-09-2006, 05:44 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums