Solved

change text to number data type

Posted on 2014-04-18
3
423 Views
Last Modified: 2014-04-18
Hello,
have a database that is created from others and long story- but question is- I have a query like the example am attaching- but based on different tables-
Is there a way in a query, or report or form to change the data type when in text - to number- for calculation purposes-
in my example:
I want to create a field called total:
which is scan number ( table1) minus ( enter number (tbl2) + outside number(tbl3)+ last number (tbl4))
textNumber.accdb
0
Comment
Question by:davetough
3 Comments
 
LVL 35

Accepted Solution

by:
PatHartman earned 500 total points
ID: 40009118
I can't download the database at this time but you would use a function to extract the numeric value.

Val(tbl1.scannumber) - val(tbl2.enternumber) + val(tbl3.outsidenumber)+ val(tbl4.lastnumber)

I chose the Val() function.  This function extracts any LEADING numbers from a string.  It has some quirks though.  You might also look at CLng(), CInt(), CDbl(), and CSng() if what you have are all numbers just stored in a text field.

When I was first learning Access the most helpful resource was the list of available functions.  You can get it from help sorted by category.  The alpha sort is pretty useless unless you know what you are looking for but the category sort lets you see all the "date" functions together and all the "financial" functions, etc.  That allows you to make informed decisions on which function is more suitable.
0
 
LVL 19

Expert Comment

by:Eric Sherman
ID: 40009119
Haven't looked at your sample yet but first try using the Val function ...

NewFieldName: Val([FieldName])


ET
0
 

Author Closing Comment

by:davetough
ID: 40009405
thank you
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
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…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
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…

840 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