RE: What does the semi-colon do in vba code?

Discussion in 'Access VBA Modules' started by OssieMac, Nov 9, 2009.

  1. OssieMac

    OssieMac Guest

    Hi Russell,

    The semicolon is not so much a concatenation character as a delimiter
    between values and when used with debug.print that is exactly what it does.
    It is similar to multiple Debug.print commands except it does not insert a
    line feed.

    Try using a a comma in lieu of the semicolon and it is more like a tab.
    (extra space)

    However, the ampersand joins all of the strings into one string and can be
    used in code to join several strings and then address them as one string.

    Example using your parameters.
    strConcatenated = "The list box contains " & intNumColumns &
    IIf(intNumColumns _
    = 1, " column", " columns") & " of data."

    Debug.Print strConcatenated

    Now some more info on your example.

    intNumColumns = 1

    This is actually +1 and the leading space produced is actually the missing +
    sign. You can't enter the + sign in your code because VBA intellisence
    removes it but try using -1 in lieu of 1 and run the code again and you will
    see what I mean.


    --
    Regards,

    OssieMac
     
    OssieMac, Nov 9, 2009
    #1
    1. Advertisements

  2. OssieMac

    Sir Joe Guest

    On Monday, 9 November 2009 05:54:01 UTC+1, OssieMac wrote:

    > Try using a a comma in lieu of the semicolon and it is more like a tab.
    > (extra space)


    thanks! this worked very well for me!
    Sir Joe
     
    Sir Joe, Sep 4, 2012
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
  1. Dirkasaurus

    Commas and Semi-colons in comboboxes

    Dirkasaurus, Sep 30, 2003, in forum: Access VBA Modules
    Replies:
    3
    Views:
    222
    Dirk Goldgar
    Oct 1, 2003
  2. M Skabialka

    Why does code turn brown in the code module?

    M Skabialka, Jan 27, 2005, in forum: Access VBA Modules
    Replies:
    6
    Views:
    104
    Tim Ferguson
    Jan 27, 2005
  3. Eric Noland

    Suspicious VB Code. What Does this VB Code Do?

    Eric Noland, Mar 10, 2005, in forum: Access VBA Modules
    Replies:
    1
    Views:
    215
    Brian
    Mar 10, 2005
  4. JDJones
    Replies:
    4
    Views:
    239
    JDJones
    Jul 17, 2006
  5. Les

    Comma in my code replaced with a semi colon ?

    Les, May 18, 2007, in forum: Access VBA Modules
    Replies:
    0
    Views:
    179
  6. Steven Sutton

    SQL statement needs to end with semi-colon?

    Steven Sutton, May 22, 2007, in forum: Access VBA Modules
    Replies:
    4
    Views:
    166
    David W. Fenton
    May 23, 2007
  7. Ken Smith

    Semi Automatic linking of front end to back end

    Ken Smith, Dec 31, 2007, in forum: Access VBA Modules
    Replies:
    1
    Views:
    129
    Tony Toews [MVP]
    Dec 31, 2007
  8. ArielZusya

    why does some code run first and other code not at all?

    ArielZusya, Jul 13, 2009, in forum: Access VBA Modules
    Replies:
    3
    Views:
    123
    PieterLinden via AccessMonster.com
    Jul 14, 2009
Loading...