Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LEFT() gives me a compile error? 3

Status
Not open for further replies.

VBAguy22

IS-IT--Management
Aug 5, 2003
180
0
0
CA
Hi
This is driving me nuts
I am picking up first letter of the clients last name field:

FL: Left(LAST_NAME,1)

Why do I get a compile error on this line? I've written 100000 Left queries before. SO frustrating.
 


Is this ACCESS or some OTHER database?

Skip,
[sub]
[glasses] [red]A palindrome gone wrong?[/red]
A man, a plan, a ROOT canal...
PULLEMALL![tongue][/sub]
 
Access query
I checked the data, it's all fine.
Weird eh?
 
My guess it has to do with the references in you database. If you do not add the correct VB reference you will not get the left function. Try this in the immediate window.
left("string",1)
See if it works. If not get the most current refernce library.
 
I am writing that in my query, hence references don't matter. I am running Access 2000, and I tried taking a Left of a "string" and still didn't work.
 
When in VBE (Alt+F11) menu Tools -> References ...
Another thing to do:
menu Debug -> Compile ...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 

"I am writing that in my query, hence references don't matter."

Sure DOES matter!

Skip,
[sub]
[glasses] [red]A palindrome gone wrong?[/red]
A man, a plan, a ROOT canal...
PULLEMALL![tongue][/sub]
 
I have the latest ADO and DAO included.
I thought Left() was a pretty basic experession in Build?
 
Does the database compiles properly ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
You guys are right. Error in VB caused that formula not to work.
 
Thanks skip,
Why do references matter in a query? Because it is Access SQL that allows you to use VB functions in a query. DAO and ADO have nothing to do with it. Check to see if you have a reference to VB. I have seen this before.
 
Thanks for the valuable tip. I had the same error in a query. By compiling the entire application I received an error in a module that I began to code but never completed. The error I received when running the query had nothing to do with the query itself, but with an error in the incomplete module
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top