Solved

convert text field to number

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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
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…

730 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