Difference between Trim() and Trim$()

  • Thread starter Thread starter Powderfinger
  • Start date Start date
P

Powderfinger

What is the difference between Trim() and Trim$()?

I notice that several functions can have the $ symbol at the end, what makes
them different?
 
If you are getting a portion of a string with the VBA string functions
(Left, LTrim, Mid, Right, RTrim, Trim) and want a string rather than a
variant, use the equivalent functions which explicitly return strings:
Left$, LTrim$, Mid$, Right$, RTrim$, and Trim$.

HTH

--
Rob Mastrostefano

FMS Professional Solutions Group
http://www.fmsinc.com/consulting

Software Tools for .NET, SQL Server, Visual Basic & Access
http://www.fmsinc.com
 
Another important difference is the fact that the string functions without
the $ sign can accept Null values as an argument, while the functions with
the $ sign can't.

Trim(Null) will simply return Null. Trim$(Null) will raise a run-time error
94 ("Invalid use of Null").
 
Back
Top