#error

S

Sarah at DaVita

I have the formula Left(Mid([serial],InStr([serial],".1"),25),4) in a query
some rows return what I want and some return #error. How do I get it to
return a null if it is #error?

----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.

http://www.microsoft.com/office/com...-bda1-7339567a4680&dg=microsoft.public.access
 
K

KARL DEWEY

I think you need to determine the error first. If ".1" does not exist in the
string you get an error.
Why not test first --
IIF(InStr([serial],".1")>0,Left(Mid([serial],InStr([serial],".1"),25),4),
Null)

Why are you returning 25 character with the Mid but only using the left 4?
So why not just this --
Mid([serial],InStr([serial],".1"),4)
 
S

Sarah at DaVita

Thanks - have no idea why i had 25 in the formula. This works great.

KARL DEWEY said:
I think you need to determine the error first. If ".1" does not exist in the
string you get an error.
Why not test first --
IIF(InStr([serial],".1")>0,Left(Mid([serial],InStr([serial],".1"),25),4),
Null)

Why are you returning 25 character with the Mid but only using the left 4?
So why not just this --
Mid([serial],InStr([serial],".1"),4)

Sarah at DaVita said:
I have the formula Left(Mid([serial],InStr([serial],".1"),25),4) in a query
some rows return what I want and some return #error. How do I get it to
return a null if it is #error?

----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.

http://www.microsoft.com/office/com...-bda1-7339567a4680&dg=microsoft.public.access
 

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