View Full Version : Problem with using expressions with strings


quinnsrq
03-02-2006, 08:56 AM
Im relatively new using queries.

I'm confused. I developed a subset of data in the same general format as our main database. When running select and update queries on this subset, I am able to use Left, Right and Len expressions such as "Right([Year],2)" and "Right([Latitude],Len([Latitude])-3) to update and generate new fields of edited data. However when I use the same expressions on the same tables and fields in the main database, I get a reply such as Function is not available in expressions in query expression 'Right([Year],2)'. A coworker says he has encountered the same problem. Has anyone else encountered this and found an interpretation/solution????

Bat17
03-02-2006, 11:09 PM
it usualy means the is a missing reference.
Open any module and then Tools>References... and look for any marked as missing.

Peter

Pat Hartman
03-03-2006, 08:15 AM
1. Year is a poor choice as a name since it is the name of a function and will therefore cause confusion in VBA.
2. string functions such as Left and Right aren't guarenteed to work against numeric data items. Convert your field to a string first for safety if they are currently numeric.
Right(CStr([Year]),2)