Results 1 to 3 of 3
  1. #1
    Silver Lounger
    Join Date
    Jan 2002
    Posts
    1,615
    Thanks
    0
    Thanked 1 Time in 1 Post

    Converting text to a number (2002)

    Hi,

    I have a table that contains numbers in text format. I need to convert these to numbers from text. In addition, I need to have the query results only show the first 3 integers. I haven't a clue as to where to start. For example the [diag] column in the query contains the text that needs to be 3 digit numbers. If the text is 00356, I need the text to be 3. Not all of the results start with zero. Below is an idea of how the numbers could be (there are thousands) and what the numerical result should be:

    104 = 104
    67001 = 670
    0014 = 1

    There is no rhymn no reason to the numbers that are in [diag] and for the life of me I just don't know where to start to convert them to a 3 digit number field.

    Thanks,
    Leesha

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Converting text to a number (2002)

    Try: CInt( Left([diag],3))
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  3. #3
    Silver Lounger
    Join Date
    Jan 2002
    Posts
    1,615
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Converting text to a number (2002)

    Thanks Mark! That is perfect!!

    Leesha

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •