Query return characters upto first space

vaughanmcd

New member
Local time
Tomorrow, 04:28
Joined
Oct 20, 2022
Messages
7
Hi I need to return charters upto the first space. Some of the lines have more than one space.

eg: LG-LIP-9024WMB 0021812 I want LG-LIP-9024WMB
or 9414894016190 FSHVE1260GL-FR 0021032 I want 9414894016190
or MS14 0029180 I want MS14

I tried this but not working New Supplier Part: Left([Search Terms],InStr([Search Terms],"/")-1)

Is the a formula?
 
Have you tried?
Code:
Left([Search Terms], InStr([Search Terms], " ") - 1)
 
Yes that work perfect, Thanks
 
Have you tried?
Code:
Left([Search Terms], InStr([Search Terms], " ") - 1)
It works when there is two or more string with spaces, But errors when there is a single string with no spaces.
Is there a way to just copy it over if its a single string aswell in the same fuction?

eg: BLS208 = BLS208
00110 0022018 = 00110

At the moment the query says conversion error when it come across something like BLS208 and will leave it blank.
 
IIF(InStr([Search Terms] & "", " ")<>0, Left([Search Terms], InStr([Search Terms], " ") - 1), [Search Terms])
 

Users who are viewing this thread

Back
Top Bottom