Solved

change text to number data type

Posted on 2014-04-18
3
419 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 34

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

747 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

14 Experts available now in Live!

Get 1:1 Help Now