#Error when using Left Function

M

Melinda

Hello,
I am trying to query out all but the last 3 characters of my contract name.
Here's the SQL I'm using:

SELECT Left([Contract],Len([Contract]-3)) AS JobCode
FROM lnkBILLEDBLIINVOICE;

I can't see anything wrong with it, but all I get is #Error in all of my
fields. Any ideas on what I'm missing? I'm using Access 97 on a Windows 98
machine.

Thanks!
Melinda
 
J

JL

Hi Melinda,

You put the "-3" in the wrong bracket.

Should be,
SELECT Left([Contract],Len([Contract])-3) AS JobCode FROM lnkBILLEDBLIINVOICE;

Hope this will help.
 
M

Melinda

Thanks for the correction, but that hasn't helped. I'm still getting the
errors. Any more ideas?

JL said:
Hi Melinda,

You put the "-3" in the wrong bracket.

Should be,
SELECT Left([Contract],Len([Contract])-3) AS JobCode FROM lnkBILLEDBLIINVOICE;

Hope this will help.


Melinda said:
Hello,
I am trying to query out all but the last 3 characters of my contract name.
Here's the SQL I'm using:

SELECT Left([Contract],Len([Contract]-3)) AS JobCode
FROM lnkBILLEDBLIINVOICE;

I can't see anything wrong with it, but all I get is #Error in all of my
fields. Any ideas on what I'm missing? I'm using Access 97 on a Windows 98
machine.

Thanks!
Melinda
 
J

JL

Hi Melinda,

That is interesting. I try my query before I send it.
What do you get when you try the query with the table statement?

SELECT Left([Contract],Len([Contract])-3) AS JobCode;

It will ask you for Contract. Just type "ABCDEFG". The query should return
"ABCD".


Melinda said:
Thanks for the correction, but that hasn't helped. I'm still getting the
errors. Any more ideas?

JL said:
Hi Melinda,

You put the "-3" in the wrong bracket.

Should be,
SELECT Left([Contract],Len([Contract])-3) AS JobCode FROM lnkBILLEDBLIINVOICE;

Hope this will help.


Melinda said:
Hello,
I am trying to query out all but the last 3 characters of my contract name.
Here's the SQL I'm using:

SELECT Left([Contract],Len([Contract]-3)) AS JobCode
FROM lnkBILLEDBLIINVOICE;

I can't see anything wrong with it, but all I get is #Error in all of my
fields. Any ideas on what I'm missing? I'm using Access 97 on a Windows 98
machine.

Thanks!
Melinda
 
J

John Spencer (MVP)

Try testing to see if there are at least 4 characters in the contract.

WHERE Len(Contract) > 3


Hi Melinda,

That is interesting. I try my query before I send it.
What do you get when you try the query with the table statement?

SELECT Left([Contract],Len([Contract])-3) AS JobCode;

It will ask you for Contract. Just type "ABCDEFG". The query should return
"ABCD".

Melinda said:
Thanks for the correction, but that hasn't helped. I'm still getting the
errors. Any more ideas?

JL said:
Hi Melinda,

You put the "-3" in the wrong bracket.

Should be,
SELECT Left([Contract],Len([Contract])-3) AS JobCode FROM lnkBILLEDBLIINVOICE;

Hope this will help.


:

Hello,
I am trying to query out all but the last 3 characters of my contract name.
Here's the SQL I'm using:

SELECT Left([Contract],Len([Contract]-3)) AS JobCode
FROM lnkBILLEDBLIINVOICE;

I can't see anything wrong with it, but all I get is #Error in all of my
fields. Any ideas on what I'm missing? I'm using Access 97 on a Windows 98
machine.

Thanks!
Melinda
 
F

fredg

Thanks for the correction, but that hasn't helped. I'm still getting the
errors. Any more ideas?

JL said:
Hi Melinda,

You put the "-3" in the wrong bracket.

Should be,
SELECT Left([Contract],Len([Contract])-3) AS JobCode FROM lnkBILLEDBLIINVOICE;

Hope this will help.

Melinda said:
Hello,
I am trying to query out all but the last 3 characters of my contract name.
Here's the SQL I'm using:

SELECT Left([Contract],Len([Contract]-3)) AS JobCode
FROM lnkBILLEDBLIINVOICE;

I can't see anything wrong with it, but all I get is #Error in all of my
fields. Any ideas on what I'm missing? I'm using Access 97 on a Windows 98
machine.

Thanks!
Melinda

Your PC may have a missing reference.
Open any module in Design view (or click Ctrl + G).
On the Tools menu, click References.
Click to clear the check box for the type library or object library
marked as "Missing:."

An alternative to removing the reference is to restore the referenced
file to the path specified in the References dialog box. If the
referenced file is in a new location, clear the "Missing:" reference
and create a new reference to the file in its new folder.

See Microsoft KnowledgeBase articles:
283115 'ACC2002: References That You Must Set When You Work with
Microsoft Access'
Or for Access 97:
175484 'References to Set When Working With Microsoft Access' for
the correct ones needed,
and
160870 'VBA Functions Break in Database with Missing References' for
how to reset a missing one.

For even more information, see
http://members.rogers.com/douglas.j.steele/AccessReferenceErrors.html
 

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