Solved

I need a query that formats a set of numbers.

Posted on 2008-06-23
5
201 Views
Last Modified: 2011-10-19
I just need an Access Query that changes the format of a set of numbers like this

08-01-   6-0059-0000-0000

into this

0801-0006-0059-0000-0000

Thank you
0
Comment
Question by:GravitaZ24
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 22

Expert Comment

by:Flyster
ID: 21847900
If your first set of numbers is always in that format, then this should work for you:

NewFormat: Left([YourNumberField],2) & Mid([YourNumberField],4,2) & "-000" & Mid([YourNumberField],8,1) & "-" & Right([YourNumberField],14)

Flyster
0
 

Author Comment

by:GravitaZ24
ID: 21848710
I'm sorry that worked for the first few numbers, but there was more to it than I realized, I attached a sample of the numbers, I have to get them into this format xxxx-xxxx-xxxx-xxxx-xxxx-xxx. The second groups of numbers is where i'm having trouble, they have to be filled in with zeros where there are blanks.
0
 

Author Comment

by:GravitaZ24
ID: 21848716
I forgot to attach to the last post, here it is
Sample.xls
0
 
LVL 22

Accepted Solution

by:
Flyster earned 125 total points
ID: 21849440
See if this works for you:

SELECT Sheet1.[Unique], Replace([Unique],"-","") AS Step1, Replace([Step1]," ",0) AS Step2, Format([Step2],"0000-0000-0000-0000-0000-000") AS Step3
FROM Sheet1;
0
 

Author Closing Comment

by:GravitaZ24
ID: 31469815
Thank you! that worked!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question