Full Version: Extracting Data From A Text Field
UtterAccess Discussion Forums > Microsoft® Access > Access Automation
shooie
I am trying to extract either the last character or last two characters from a text filed.

I have a text field named LocationID.
If the value in LocationID is "SEA8" I only want it to extract the "8" but if the value is "SEA12" I want it to extract "12".

Is there a way to extract only the integers from a text filed?

Jeremy
theDBguy
Hi Jeremy,

Without knowing the entire business rule, I hope this Wiki Article works for you: GetDigitsOnly

Just my 2 cents... 2cents.gif
River34
Is the location ID always 'SEA' then a digit? If it is, use the mid function

Mid([MyTable]![LocationID], 4, Len([MyTable]![LocationID]) -3)

shooie
good thought, but unfortunately the alpha portion of the string may be 3 to 7 character. The Wiki link that TheDBguy referenced worked great.

Thank you

theDBguy
Hi,

yw.gif

River and I are happy to help. Good luck with your project.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.