return part of a field

M

mbc04

I have a field called OCLC# . From that field I want to extract just
the numbers that come after the letters ocm. If the field does not
contain ocm, then return a 0.

Here are some examples of data that are in this field.
ex. (OCoLC)ocm46621126
ocm13214937
90008576 /AC

The results should be: 46621126
13214937
0
How do I do this?
 
T

Tom Lake

I have a field called OCLC# . From that field I want to extract just
the numbers that come after the letters ocm. If the field does not
contain ocm, then return a 0.

Here are some examples of data that are in this field.
ex. (OCoLC)ocm46621126
ocm13214937
90008576 /AC

The results should be: 46621126
13214937
0
How do I do this?

IIf(Instr([MyStr], "ocm") > 0, Val(Mid([MyStr], Instr([MyStr], "ocm") + 1), 0)

Tom Lake
 

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