Inserting hyphen in Number String

B

BLG

I need to insert a hyphen in a string of numbers.

The string of numbers currently looks like this:

AC208370050
AC208371000
AC222630050
AC222631000

I need to insert the hyphen in the same location for all
of the numbers, which is 7 numbers to the left. In other
words, the number AC208370050 should have the hyphen
inserted like this: AC20837-0050.

The remaining numbers in the example above should have the
hyphen inserted at the same location. So they would change
to this:

AC20837-1000
AC22263-0050
AC22263-1000

All of the numbers in this field have 11 digits, and the
hyphen should be inserted between the 7th and 8th digit,
counting from the left.

How do I insert this hyphen in Access?

Brenda
 
C

Cheryl Fischer

You can put the following expression in the Update to: row of an Update
query:

Left([MyField], 7) & "-" & Mid([MyField], 8)



hth,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top