When doing string concatenation, is there any practical difference between using + versus & ?
Anytime one should prefer one over the other, or not use one or the other?
The Ampersand(&) is defined as: Used to force string concatenation of two expressions.
While the Addition(+) sign has numerious functions. It can be the same as Ampersand if both expressions are strings. Here are a couple of combinations and the way the operator acts:
String & String = cancatenation
String + String = cancatenation
Numeric + Numeric = addition
Numeric + Variant = addition
See ACCESS Help for the + operator for a complete definition of the other possibilities.
Bob Scriver
Nobody believes the official spokesman... but everybody trusts an unidentified source.
Author, Bagdad Bob???
Looks like the "+" operator will attempt a data conversion with a prejudice to numeric, while "&" will do the same for string. Could make for some interesting bugs in a program.
You can use a combination if you have a primary and an optional secondary value to display a separator (such a line) between the values or just the primary value (without the separator) if secondary value does not exist.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.