Thread: Instr help
View Single Post
  #3  
Old May 19th, 2010, 09:23 PM posted to microsoft.public.access
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Instr help

On Wed, 19 May 2010 19:46:33 GMT, "fhurman via AccessMonster.com" u43637@uwe
wrote:

Hello,

I've spent quite a bit of time in Excel using the SEARCH function to parse
out names from a text field thinking I'd be able to use this same expression
once I brought the data into Access. As I find out I guess I need to be
using the InStr function in Access but I'm still having a little trouble.

Here's an example of the text field : 00022956CTE/Smith,Harry
And here's an example of the SEARCH function I used in Excel which produced
"Harry": =+RIGHT(C2,LEN(C2)-SEARCH(",",C2,1))

When I try to run an Update query to a blank field with this in Access
replacing "SEARCH" with "InStr" I get a "Type conversion error" on all of the
records. Can anyone assist? I have a feeling I'm missing something fairly
obvious here.

Thanks!


We're not there, and we can't see your screen. You clearly didn't use that
exact expression with CELL references - Access is not a flawed implementation
of Excel!

To extract the text after the comma you would use an expression:

Mid([fieldname], InStr([fieldname], ",") + 1)

--

John W. Vinson [MVP]