parsing text file

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'M TRYING TO RETURN EVERYTHING TO LEFT OF THE FIRST
HYPHEN IN THE FIELD AND THE WHOLE FIELD IF A HYPHEN IS NOT
PRESENT

EXAMPLE RETURN
10-0-00-00 10
20-0-00-00 20
130-0-00-00 130
7550-0-00-00 7550
NONE NONE
APPLE APPLE
 
If you're trying this in a query, you'd use the IIF() function, the Instr()
function, and the Left() function. The following is untested aircode:


IIF(InStr([YourField],"-")=0,[YourField],Left([YourField],InStr([YourField]-
1))

(in English, if your field doesn't have a hyphen, show it all, otherwise,
show the leftmost portion up to where the hyphen it)
 
Back
Top