Remove Preceeding Characters in table

J

JAG11300

Hi all!

Quick question. This may have been answered somewhere, but I can't find it.

At a very basic level, this is what I need...

My table is tblHold and my field is Style

Current Data for Style
1234
46-1234
5678a
36-43a21

Get the idea? I want to know what I can do via code to remove the "-" as
well as all preceeding characters. I do not want to do Find and Replace *-
everytime we paste new data into the table. Since I'm already doing other
tasks relating to this table using code, I'd like to include this to make
everything as simple as possible. One stop shopping. :)

I've seen some posts on the replace funtion, but I'm not sure how to do that
using what would need to be a wildcard.

Any help is greatly appreciated!!!!!

-- Juli --
 
M

Marshall Barton

JAG11300 said:
Quick question. This may have been answered somewhere, but I can't find it.

At a very basic level, this is what I need...

My table is tblHold and my field is Style

Current Data for Style
1234
46-1234
5678a
36-43a21

Get the idea? I want to know what I can do via code to remove the "-" as
well as all preceeding characters.


postfix = Mid(Me.Style, Instr(Me.Style, "-") + 1)
 
J

JAG11300

Thanks for the fast reply. I’ll give it a whirl. In the meantime…

Forgive my ignorance, but I’m a bit confused. I thought “postfix†had
something to do with mail. I’ve never used it before, but I possibly
remember the mention of it in a class or somewhere. So, sorry to be a
bother, but would you spoon feed me a bit? What does postfix do?


-- Juli --


:

JAG11300 wrote:
Quick question. This may have been answered somewhere, but I can't find it.

At a very basic level, this is what I need...

My table is tblHold and my field is Style

Current Data for Style
1234
46-1234
5678a
36-43a21

Get the idea? I want to know what I can do via code to remove the "-" as
well as all preceeding characters.


postfix = Mid(Me.Style, Instr(Me.Style, "-") + 1)


Marsh
MVP [MS Access]
 
M

Marshall Barton

It's just a sample VBA variable, I could just as easily
said:
x = Mid(Me.Style, Instr(Me.Style, "-") + 1)

Maybe you didn't mean to imply that you wanted an answer to
be used in a VBA procedure. If you want to do this
operation in a calculated field in a query, you would just
use the expression (not code):
Mid(Style, Instr(Style, "-") + 1)
 
J

JAG11300

Marshall,

After my last post, I realized that (as you've noted) I was making things
far too complicated. I always know that if there is a "-", it will be in the
3rd position. I did exactly as you said and created a calc field in a query
that was already being ran based off this table. Sometimes it's hard to see
the forest - those pesky trees are always in the way. :)

Thank you again, for your promptness and willingness to work with this
newbie.

-- Juli --


Marshall Barton said:
It's just a sample VBA variable, I could just as easily
said:
x = Mid(Me.Style, Instr(Me.Style, "-") + 1)

Maybe you didn't mean to imply that you wanted an answer to
be used in a VBA procedure. If you want to do this
operation in a calculated field in a query, you would just
use the expression (not code):
Mid(Style, Instr(Style, "-") + 1)
--
Marsh
MVP [MS Access]

Thanks for the fast reply. I’ll give it a whirl. In the meantime…

Forgive my ignorance, but I’m a bit confused. I thought “postfix†had
something to do with mail. I’ve never used it before, but I possibly
remember the mention of it in a class or somewhere. So, sorry to be a
bother, but would you spoon feed me a bit? What does postfix do?


:

JAG11300 wrote:
Quick question. This may have been answered somewhere, but I can't find it.

At a very basic level, this is what I need...

My table is tblHold and my field is Style

Current Data for Style
1234
46-1234
5678a
36-43a21

Get the idea? I want to know what I can do via code to remove the "-" as
well as all preceeding characters.


postfix = Mid(Me.Style, Instr(Me.Style, "-") + 1)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top