A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

#ERROR question



 
 
Thread Tools Display Modes
  #1  
Old June 19th, 2009, 07:30 PM posted to microsoft.public.access.queries
Elmtree via AccessMonster.com
external usenet poster
 
Posts: 5
Default #ERROR question

My formula:

Mid([f1],InStr(10,[f1],": ")-1)

returns #ERROR if the value is blank, otherwise works fine. Any ideas how to
change my formula to get beyond the #ERROR?

Thanks

mike

--
Message posted via http://www.accessmonster.com

  #2  
Old June 19th, 2009, 08:35 PM posted to microsoft.public.access.queries
John W. Vinson
external usenet poster
 
Posts: 18,261
Default #ERROR question

On Fri, 19 Jun 2009 18:30:25 GMT, "Elmtree via AccessMonster.com" u45848@uwe
wrote:

My formula:

Mid([f1],InStr(10,[f1],": ")-1)

returns #ERROR if the value is blank, otherwise works fine. Any ideas how to
change my formula to get beyond the #ERROR?

Thanks

mike


IIf(InStr([f1], ": ") = 0, "", Mid([f1],InStr(10,[f1],": ")-1))
--

John W. Vinson [MVP]
  #3  
Old June 19th, 2009, 08:43 PM posted to microsoft.public.access.queries
Jerry Whittle
external usenet poster
 
Posts: 4,732
Default #ERROR question

Mid doesn't play well with 0, negative numbers, or nulls.

IIf(Len([f1])10, Mid([f1],InStr(10,[f1],": ")-1),Null)

Or maybe

IIf(InStr(10,[f1],": "10, Mid([f1],InStr(10,[f1],": ")-1),Null)

--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.

"Elmtree via AccessMonster.com" wrote:

My formula:

Mid([f1],InStr(10,[f1],": ")-1)

returns #ERROR if the value is blank, otherwise works fine. Any ideas how to
change my formula to get beyond the #ERROR?

Thanks

mike

--
Message posted via http://www.accessmonster.com


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:21 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.