Results 1 to 4 of 4
  1. #1
    irish634 is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    48

    Code cleanup question

    This is a pretty basic question.



    If I have strings in my VBA:

    • sSQL = "Select..."
    • sPrompt = "Whatever text"
    • sTitle = "Whatever text"

    Should I set them all to "" when the procedure is complete? Is it necessary?


    I already set DB, TD, RS etc to "Nothing" but was curious about strings.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Not necessary. Generally you only have to clean up anything that you set with "Set".
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    I don't do that kind of cleanup except when I'm looping and have to re-use variables.

    Even then, I don't know if it is really necessary [because replacing what's in a variable] - but it helps mekeep my logic straight because I see that block of code re-setting all my variables and it's a visual reminder that I'm done with what was in the variables and the code block that was using them.

    I believe Access handles that kind of cleanup going back at least a couple of versions.

  4. #4
    irish634 is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    48
    Thanks. I thought it was overkill then a colleague suggested it.

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

Similar Threads

  1. open form code question
    By budchevy in forum Programming
    Replies: 7
    Last Post: 02-22-2012, 08:56 PM
  2. Question about some code in a macro
    By AudiA4_20T in forum Programming
    Replies: 2
    Last Post: 07-11-2011, 08:16 AM
  3. Simple code syntax question
    By mseeker22 in forum Programming
    Replies: 1
    Last Post: 07-07-2011, 03:55 AM
  4. Word code in Access - How to modify my current code
    By Alexandre Cote in forum Programming
    Replies: 0
    Last Post: 11-15-2010, 08:26 AM
  5. ODBC Cleanup
    By pkstormy in forum Code Repository
    Replies: 0
    Last Post: 08-24-2010, 12:18 AM

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