Here's a sample Sub
Public Sub Semicolon_test()
Dim intNumColumns As Integer
intNumColumns = 1
'Semi-colon example
Debug.Print "The list box contains"; intNumColumns; IIf(intNumColumns =
1, "column", "columns"); " of data."
'Same thing except the semicolon is replaced with the ampersand and the
spacing is modified.
Debug.Print "The list box contains " & intNumColumns & IIf(intNumColumns
= 1, " column", " columns") & " of data."
End Sub
The semi-colon in Print is a value separator (without a
space or starting new line).
The alternative is to use a comma, which uses some strange
idea of a column to separate the values (kind of like a
tab?).
Concatenation is a different issue, even if the result looks
similar.
--
Marsh
MVP [MS Access]
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