Trim command

  • Thread starter Thread starter Tammi
  • Start date Start date
T

Tammi

I have the text CB3-479-453-B00001.

I want to run an update query where it only insert the
text to the right of CB3-479-453-

I could use the right command, but the B00001 is not
always 6 characters. So I want to trim the first 12
characters leaving whatever is left. I'm looking for the
LTrim command, but keep getting an error with this.
LTrim([Dwg. No.],12)

Any help?
 
Tammi,

You need to use the Right() function along with the InStrRev() function to
find the first occurrence of "-" from the right. Here is a sample:

Right([MyField], Len(Trim([MyField])) - InStrRev([MyField], "-"))


hth,
 
Wow!! That's not the LTrim command, but it sure does the
trick!!

Thanks much for your help!
-----Original Message-----
Tammi,

You need to use the Right() function along with the InStrRev() function to
find the first occurrence of "-" from the right. Here is a sample:

Right([MyField], Len(Trim([MyField])) - InStrRev ([MyField], "-"))


hth,
--
Cheryl Fischer
Law/Sys Associates
Houston, TX

I have the text CB3-479-453-B00001.

I want to run an update query where it only insert the
text to the right of CB3-479-453-

I could use the right command, but the B00001 is not
always 6 characters. So I want to trim the first 12
characters leaving whatever is left. I'm looking for the
LTrim command, but keep getting an error with this.
LTrim([Dwg. No.],12)

Any help?


.
 
Cheryl,

And I was doing so good! :)

I ran into a glitch. There are also nubmers in that
string that have an extra -
CB3-479-453-D02-088888-01A

I want to omit the CB3-479-453- but leave the rest. The
funtion you gave me only leaves the 01A which is why I was
thinking the trim command was what I was looking for.
Sorry about that.

Any other ideas???

You may e-mail me direct if you'd like at
(e-mail address removed)

Thanks much!!!!
-----Original Message-----
Tammi,

You need to use the Right() function along with the InStrRev() function to
find the first occurrence of "-" from the right. Here is a sample:

Right([MyField], Len(Trim([MyField])) - InStrRev ([MyField], "-"))


hth,
--
Cheryl Fischer
Law/Sys Associates
Houston, TX

I have the text CB3-479-453-B00001.

I want to run an update query where it only insert the
text to the right of CB3-479-453-

I could use the right command, but the B00001 is not
always 6 characters. So I want to trim the first 12
characters leaving whatever is left. I'm looking for the
LTrim command, but keep getting an error with this.
LTrim([Dwg. No.],12)

Any help?


.
 
You're welcome and good luck with your project.

FYI, LTrim() and RTrim() are designed to remove leading or trailing spaces,
respectively. Trim() will remove leading and trailing spaces.



--
Cheryl Fischer
Law/Sys Associates
Houston, TX

Tammi said:
Wow!! That's not the LTrim command, but it sure does the
trick!!

Thanks much for your help!
-----Original Message-----
Tammi,

You need to use the Right() function along with the InStrRev() function to
find the first occurrence of "-" from the right. Here is a sample:

Right([MyField], Len(Trim([MyField])) - InStrRev ([MyField], "-"))


hth,
--
Cheryl Fischer
Law/Sys Associates
Houston, TX

I have the text CB3-479-453-B00001.

I want to run an update query where it only insert the
text to the right of CB3-479-453-

I could use the right command, but the B00001 is not
always 6 characters. So I want to trim the first 12
characters leaving whatever is left. I'm looking for the
LTrim command, but keep getting an error with this.
LTrim([Dwg. No.],12)

Any help?


.
 
If you want to remove a given number of characters from the left, you can
use the Mid function without a 3rd parameter.

Mid([MyField], 13) will remove the first 12 characters.

--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)



Tammi said:
Cheryl,

And I was doing so good! :)

I ran into a glitch. There are also nubmers in that
string that have an extra -
CB3-479-453-D02-088888-01A

I want to omit the CB3-479-453- but leave the rest. The
funtion you gave me only leaves the 01A which is why I was
thinking the trim command was what I was looking for.
Sorry about that.

Any other ideas???

You may e-mail me direct if you'd like at
(e-mail address removed)

Thanks much!!!!
-----Original Message-----
Tammi,

You need to use the Right() function along with the InStrRev() function to
find the first occurrence of "-" from the right. Here is a sample:

Right([MyField], Len(Trim([MyField])) - InStrRev ([MyField], "-"))


hth,
--
Cheryl Fischer
Law/Sys Associates
Houston, TX

I have the text CB3-479-453-B00001.

I want to run an update query where it only insert the
text to the right of CB3-479-453-

I could use the right command, but the B00001 is not
always 6 characters. So I want to trim the first 12
characters leaving whatever is left. I'm looking for the
LTrim command, but keep getting an error with this.
LTrim([Dwg. No.],12)

Any help?


.
 
Hi,


Mid( String, 13)


would return the string, where its first twelve characters are removed ( you
mentioned earlier that you always drop the first 12 chars, isn't it? )


Vanderghast, Access MVP



Tammi said:
Cheryl,

And I was doing so good! :)

I ran into a glitch. There are also nubmers in that
string that have an extra -
CB3-479-453-D02-088888-01A

I want to omit the CB3-479-453- but leave the rest. The
funtion you gave me only leaves the 01A which is why I was
thinking the trim command was what I was looking for.
Sorry about that.

Any other ideas???

You may e-mail me direct if you'd like at
(e-mail address removed)

Thanks much!!!!
-----Original Message-----
Tammi,

You need to use the Right() function along with the InStrRev() function to
find the first occurrence of "-" from the right. Here is a sample:

Right([MyField], Len(Trim([MyField])) - InStrRev ([MyField], "-"))


hth,
--
Cheryl Fischer
Law/Sys Associates
Houston, TX

I have the text CB3-479-453-B00001.

I want to run an update query where it only insert the
text to the right of CB3-479-453-

I could use the right command, but the B00001 is not
always 6 characters. So I want to trim the first 12
characters leaving whatever is left. I'm looking for the
LTrim command, but keep getting an error with this.
LTrim([Dwg. No.],12)

Any help?


.
 
Cheryl,

Thanks for your help, but I think I finally got it. I was
able to use

Mid$([MyField],13)

Thanks, Tammi
-----Original Message-----
Tammi,

You need to use the Right() function along with the InStrRev() function to
find the first occurrence of "-" from the right. Here is a sample:

Right([MyField], Len(Trim([MyField])) - InStrRev ([MyField], "-"))


hth,
--
Cheryl Fischer
Law/Sys Associates
Houston, TX

I have the text CB3-479-453-B00001.

I want to run an update query where it only insert the
text to the right of CB3-479-453-

I could use the right command, but the B00001 is not
always 6 characters. So I want to trim the first 12
characters leaving whatever is left. I'm looking for the
LTrim command, but keep getting an error with this.
LTrim([Dwg. No.],12)

Any help?


.
 
Back
Top