Thread: Instr help
View Single Post
  #4  
Old May 19th, 2010, 09:28 PM posted to microsoft.public.access
John Spencer
external usenet poster
 
Posts: 7,815
Default Instr help

Easiest way if your string contains only one comma.
Mid(SomeString,Instr(1,SomeString,",")+1)

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

fhurman via AccessMonster.com 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!