The Trim method (Trim, LTrim and RTrim)

A

Andrew

I am having problems determining what reference controls
the Trim, LTrim and RTrim methods. The invironment that I
am designing this VBA application will not except the use
of Trim method. The error message comes from Visual basic
and reads "Compile error: Can't find project or library.
I am using it to save files from a database name value
but the string value of the database name field creates a
blank space which I need to remove.

Thanks in advance,

Andrew
 
M

Malcolm Smith

Andrew

When I get this I find it's that it's something else that has gone wrong,
usually another reference to an object or a template which can't be
resolved.

Sometimes I find it's the Left$() function which is 'missing' when the
problem is actually elsewhere.

I find it's actually a bogus message in that it's not the Trim stuff which
is missing but something else. What does the Reference list suggest?

- Malc
 
A

Andrew

Hi,

When I remove the trim statement the application runs
fine. For example, the trim statement is Trim
(strVariable), when I change it to strVariable the
application works fine. The problem is that I need to
remove the dead space at the end of the string so that it
doesn't show up in the final result. To help you
understand, the variable is being used to create a file
name. With the Trim statement the file name should look
like "strVariable.doc" Without the Trim statement the
file name looks like "strVariable .doc" It is the
space that I am trying to remove. The Trim statement is
being rejected.

Thanks in advance,
 
J

JB

Andrew said:
Hi,

When I remove the trim statement the application runs
fine. For example, the trim statement is Trim
(strVariable), when I change it to strVariable the
application works fine. The problem is that I need to
remove the dead space at the end of the string so that it
doesn't show up in the final result. To help you
understand, the variable is being used to create a file
name. With the Trim statement the file name should look
like "strVariable.doc" Without the Trim statement the
file name looks like "strVariable .doc" It is the
space that I am trying to remove. The Trim statement is
being rejected.

Thanks in advance,


that has gone wrong,


which can't be


is 'missing' when the


the Trim stuff which


list suggest?
Hi Andrew,
I think what Malc is trying to get you to do is look in the VBE under
Tools > References and this should show you a list of expected
references. If any of them say "Missing" then your problem is there.
Malc is right I think, as this has been my experience in the past also.

HTH

J
 

Ask a Question

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. After that, you can post your question and our members will help you out.

Ask a Question

Top