How do I remove everything after a symbol for a string in a form

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

Guest

Hi folks,

I have a set of uniquely identified similar objects (aaaa_12, aaaa_219,
aaaa_19 etc). For the purposes of the form I would like to cut the string so
it just displays the aaaa.

i.e. if aaaa_12 is the string, i would like the new string to be aaaa.

Thanks
 
James123456 said:
Hi folks,

I have a set of uniquely identified similar objects (aaaa_12,
aaaa_219, aaaa_19 etc). For the purposes of the form I would like to
cut the string so it just displays the aaaa.

i.e. if aaaa_12 is the string, i would like the new string to be aaaa.

Thanks

Is the beginning always exactly 4 characters? If so just use Left(FieldName, 4)

If the number of characters varies, but you always want everything up to the
underscore then use...

=Left(FieldName, InStr(FieldName, "_")-1)
 
Create a query into this table.

In the Field row, type something lik e this:
Left([Field1], Instr([Field1], "_") - 1)
replacing Field1 with the name of your field.

If you actually wanted to replace the contents of the field with the shorter
version, you could change the query into an Update query (Update on Query
menu.)
 
Back
Top