Solved

how to format a field in a query

Posted on 2016-10-20
4
55 Views
Last Modified: 2016-10-21
I have a column that is created that has 3 characters long

As an example the query could return

001
010
123

I want to format the field so that only the digits appear, no leading 0's so my desire is to show:

1
10
123
0
Comment
Question by:seamus9909
[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
  • 2
4 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 41853180
try this

select val([nameOfField]) from tableX
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 41853181
you can also use

select cint([nameOfField]) from tableX
0
 
LVL 21
ID: 41853182
turn on properties -- press Alt-Enter if it is not showing
then click in the column you want to format on the grid

in the Format property, type your format code -- or edit what is already there.

However, it could be that text is stored, not a number.  In that case, you can use a conversion function to turn it into a number. For instance:
MyNumber: CInt([MyTextFieldname])

Open in new window

Perhaps what you really want is to change the data type to a number?
0
 

Author Closing Comment

by:seamus9909
ID: 41853891
Thank you so Much
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

696 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