• Converting a text field to a numeric field (2000)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Converting a text field to a numeric field (2000)

    Author
    Topic
    #390346

    Is it possible to convert a text field to a numeric field within a query? I want to sort on a field within my query that is set as text but stores digits (sort 1,2,3,4,5…), and I can’t modify the tables. The query is currently sorting (1,10,11,12,13….2,20,21,22….)

    Thanks!
    Kindra

    Viewing 0 reply threads
    Author
    Replies
    • #692918

      Hi Kindra…

      Try creating a calculated field in the query and sorting on that…
      For example… fldNumeric: CLng([fldText])
      This will Convert the Text Values to Long Integer… (There are numerous conversion functions… CDbl (convert to double), CStr(convert to string), etc… )
      If you then set the sorting to ascending on fldNumeric field, your resulting records will be sorted correctly…
      You can also hide the calculated field so that there is no confusion between the two…

      HTH

    Viewing 0 reply threads
    Reply To: Converting a text field to a numeric field (2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: