Solved

convert text field to number

Posted on 2006-11-30
4
272 Views
Last Modified: 2008-01-09
I have an access linked table to a a sql table and it lists an order qty field as text, even though it is decimal in the sql table.  I am trying to round down (or int) in access but it won't because it is a text field.  I cannot find the right command to convert the text field in the query to number.

Thanks,
dave
0
Comment
Question by:barleyfreak
  • 2
4 Comments
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 18050049
If IsNumber(TextField) then
    Value = cInt(TextField)
End If

Like that?

AW
0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 18050053
maybe the function is

IsNumeric(TextField)

AW
0
 
LVL 16

Accepted Solution

by:
GreymanMSC earned 250 total points
ID: 18050535
Use:

  Iif(IsNumeric(TextField), CInt(TextField), 0)

Or:

    CInt(Val(TextField))

Val() will inspect the start of a text field for numeric characters and return a legible number. IE: "10.4A" will return 10.4 .  If no number is found, it will return 0.
0
 

Author Comment

by:barleyfreak
ID: 18050604
thank you,

  Iif(IsNumeric(TextField), CInt(TextField), 0)

did the trick.

cheers,
dave
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

839 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