Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to Modify formula with IF Then 1

Status
Not open for further replies.

kenp705

Technical User
Jul 7, 2006
15
US
I use WinXP and CR for ESRI XI. I have a field called Nature which contains a string that includes a "-". I have a formula field that extracts the characters before the "-", Left({tblIncidents.Nature},(InStr({tblIncidents.Nature},'-')-1)). The problem is when it comes to a Nature that does not have a "-", it stops with an error. Could you help me with modifying my formula. I was thinking that maybe an If then statement might help. I need something that would just return an "error" when it comes to a nature that doesn't have a "-". Thank you for any help.....
 
Try this:
Code:
If InStr({tblIncidents.Nature},'-') > 0 then
Left({tblIncidents.Nature},(InStr({tblIncidents.Nature},'-')-1))  
else
"error"

Bob Suruncle
 
BobSurUncle, you are a life saver. Thankyou. I just saw your previous reply and was working on that. Your suggestion works like a champ...... Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top