Click to See Complete Forum and Search --> : Text-Manipul. in Access
July 30th, 1999, 02:00 PM
My problem is cutting off two characters from the left side in a MS Access-Query. I know that there are bulid-in functions in the expression builder, but I don't know which fits and how I can get my column data in there.
Thanks for helping.
NicolasDesprez
July 30th, 1999, 08:07 PM
Here is the code you could insert in your query, assuming that a two (or less) characters long string
would be completely cut off. Maybe there's a more simple way to do it, but this example should work.
croppedstr: Iif(Len(str) < 2, Null, Right(str, Len(str) - 2))
ttuerk
August 2nd, 1999, 12:02 PM
Thank you very much! I have further problems implementing this, because
I'am real beginner in VB. Could you help me again declaring the variables in access so that I can use it in a query or should I write a module?
I assume your formula cuts-off the two last characters, is this right? If I want
the first two I have to use left() I suppose.
Thanks in advance.
NicolasDesprez
August 12th, 1999, 07:02 PM
Well, this function should cut off the first two characters, did you try it?
You can use a VB variable in a query, for that purpose you should create a function that returns this
variable everytime it's called, i.e. :
'--------------------------------------
' module1
Global Variable as <type>
'
' module2
' [...]
Variable = <value>
' [...]
'
' module3
Function GetVariable() as <type>
GetVariable = Variable
End Function
'---------------------------------------
You can use this GetVariable() function in all your queries (don't forget the parenthesis) just like a built-in
Access function. Note that the VB declarations could be part of the same module.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.