Share via

HELP: Remove characters after hyphen in access database

Anonymous
2010-11-22T15:52:34+00:00

Hi All,

I have an access database where for one field I have number in following format:

1234 - 5678

How can I get rid of the characters listed after the hyphen? i.e. "5678"

I could update it manually, but I have 100's of such numbers.

Is there a function that I can use in a Query to make this happen?

Thanks in advance

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2010-11-22T15:57:44+00:00

UPDATE YourTable

SET YourField = Trim(Left([YourTable].[YourField],Instr(1,[YourTable].[YourField],"-")-1))

WHERE YourField Like "*-*"

The expression you need to put in the Update to is

     Trim(Left([YourTable].[YourField],Instr(1,[YourTable].[YourField],"-")-1))

The criteria is

     Like "*-*"


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

Was this answer helpful?

0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2010-11-22T17:02:34+00:00

    Worked out great!

    Thanks John

    Was this answer helpful?

    0 comments No comments