The ampersand also functions as a type declaration for a long integer, i.e.:
2
would be an integer, but:
2&
is a long integer.
If you open the immediate window (Ctrl+G), and enter:
? 200 * 200
Access gives you an overflow error.
If you specify one of the values as a Long, it does not overflow, e.g.:
? 200& * 200
So, there are contexts in which VBA can misunderstand the ampersand as a
type declaration characters if you do not enter a space before it.
--
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.
"MLH" <CR**@NorthState.net> wrote in message
news:b7********************************@4ax.com...
I have tried the following in the immediate window.
It yields an error...
?"Hello"&vbCrLf&"there"&vbCrLf&"next"&vbCrLf&"line ."
'Type declaration character does not match declared data type.
But the following does works as expected...
?"Hello" & vbCrLf & "there" & vbCrLf & "next" & vbCrLf & "line."
Is it pretty much standard that concatenations must be constructed
with spaces surrounding the ampersands ALL the time? I do not
believe that was the case with Access Basic in Access 2.0.