Solved

convert text field to number

Posted on 2006-11-30
4
274 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
[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 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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

717 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