tags:

views:

119

answers:

5

Hi,

i am trying to write a query using left function in access to take only the first 3 characters of a field.

Is there any alternative method for performing the same process without using left

Usage of left function shows a compile. error all of a sudden without any reason. If i copy the table and query to a new database it works fine for a while before the error comes again. This happens only on the usage of Left function.

+3  A: 

The compile error is showing up because you have a missing reference. Open any module and check the References.

Raj More
i did that no references missing
tksy
Does your code compile?
David-W-Fenton
+2  A: 

you can use mid function:

Mid (Field, 1, 3)
Wael Dalloul
+2  A: 

You can always try Mid

Mid([field1],1,3)
astander
+2  A: 

It sounds very like you have a problem with your references. Look for any references marked "MISSING". Also try to delete Visual Basic for Applications, it won't allow this, but it sometimes corrects the problem. Finally, check the details of Visual Basic for Applications and make sure that is available in the stated location. Any alternative to Left will be affected by this problem.

This problem is frequently associated with a missing reference that you would not think had anything to do with Left.

Remou
i did think of the missing reference part , but there is no missing references.
tksy
+1  A: 

Run the following code and report back as to the results. Also tell us what version of Access you are running.

Sub ViewReferenceDetails()

Dim ref As Reference

    For Each ref In Access.References
        Debug.Print ref.Name & " - " & ref.Major & "." & ref.Minor & " - " & ref.FullPath
    Next ref

End Sub
Tony Toews
@Tony, Consider adding **IIf(ref.IsBroken, "BROKEN", "OK")**
HansUp