How much formatting/code can you use in a txtbox?

VegaLA

Registered User.
Local time
Today, 06:44
Joined
Jul 12, 2006
Messages
101
Hi all,
I have a textBox on a form which pulls in the value of a field from a query that the form is based on but I would like to truncate it. Using =Left([]myfield)-4 does'nt work as you can imagine so I have to use the LEN function but how do I do so in the control property of a textbox ?

I appreciate any help on this issue.

Thanks in advance,
Mitch...
 
Are you just trying to shrink the field by 4 characters? If so then:
Left([YourField],Len([YourField])-4) should do it.
 
Cheers Rural.

No, i'm actually trying to take the first four characters away from that value so the rest of the value is dispalyed. I thougth I would have to work out the length of value then minus 4 from that number and use the value of that as the value to use the function RIGHT with.

But yeah, basically I just want to do away with the first four characters of a value and display the rest.

Thanks,
Mitch.......
 
Use Mid$( ) - specify starting point is 5th character, use actual length of the string or just pick a silly, big, constant that is the size of overall field as defined in the table definition. Mid$() will note that you are "stupid" enough to give it the wrong length but will do the right thing anyway, being the trusting piece of code that it is. You will get the entire length of the string except for the four characters you skipped.
 
As Doc said: Mid([YourField],5) will start on the 5th character of the field and return the rest of the string regardless of length.
 
Ahh, thats excellent, thanks to you both !
 

Users who are viewing this thread

Back
Top Bottom