Solved

convert text field to number

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now