Solved

change text to number data type

Posted on 2014-04-18
3
424 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
[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
3 Comments
 
LVL 36

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

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
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.
Familiarize people with the process of utilizing SQL Server stored procedures 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 Micr…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

749 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