text to number format or preceeding 0

  • Thread starter Thread starter JHardy
  • Start date Start date
J

JHardy

I need text to number format preceeding with zeros or text to be right
justified or preceed with zeros. I am importing a raw txt file into a dbase
but there is one field I need changed to right justified. After I make a few
other changes I need to export back to a TXT file with the following change.

Example A. # or txt 1 changed to 0001
EXample B. #1 right justified

I actually need to convert this TXT record ,
001|12|0007154700100|1|0007154700100|3.0|JL SLINKY-BOXED|
To this TXT record
001120007154700100 100071547001003.0 JL SLINKY-BOXED

Hope someone understands this mess I tried to explain
Thanks
 
Use the Replace function as below if the position is always a digit between
verticals.

Replace(Replace([YourTextField],"|1|"," 1"),"|","")
 
I need text to number format preceeding with zeros or text to be right
justified or preceed with zeros. I am importing a raw txt file into a dbase
but there is one field I need changed to right justified. After I make a few
other changes I need to export back to a TXT file with the following change.

Example A. # or txt 1 changed to 0001
EXample B. #1 right justified

I actually need to convert this TXT record ,
001|12|0007154700100|1|0007154700100|3.0|JL SLINKY-BOXED|
To this TXT record
001120007154700100 100071547001003.0 JL SLINKY-BOXED

Hope someone understands this mess I tried to explain
Thanks

I'd suggest using File... Get External Data... Import to import the
text file; use the Import Wizard to select | as the delimiter and
import each field into a different Text datatype field.

You can then create a Query blank- or zero-filling the field you're
trying to expand; if the field is named Field4, you could use

ExpField4: Right(" " & [Field4], 4)
or
ExpField4: Right("0000" & [Field4], 4)

respectively. This will convert "1" to "0001", "123" to "0123" and so
on.

John W. Vinson[MVP]
 

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

Back
Top