Solved

change text to number data type

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
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…
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…

863 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

28 Experts available now in Live!

Get 1:1 Help Now