Solved

Adding number to text field

Posted on 2014-01-13
5
597 Views
Last Modified: 2014-01-13
I have a field [Transaction Number] that is formatted as a text field. The value is 000002. I need to add the number 231955 to the value from a query and have it display 231955.

When I use the formula FormatNumber(CInt([Transaction Number]),0,0,0)+[CurrentTransNumber] in the query I get 2231955.

When I use the formula FormatNumber(CInt([Transaction Number]),0,0,0)+CInt([CurrentTransNumber]) I get a stack overflow error.

How do get it to add and not combine text values?
0
Comment
Question by:PetGuy
[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
5 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39776922
change "CInt" to "Clng"
0
 
LVL 50

Accepted Solution

by:
Gustav Brock earned 500 total points
ID: 39777091
You could simply use:

Format(Val([Transaction Number]) + Val([CurrentTransNumber]), "000000")

/gustav
0
 

Author Closing Comment

by:PetGuy
ID: 39777114
Just what I needed, and fast
0
 
LVL 40

Expert Comment

by:als315
ID: 39777124
In query you should be able to sum numeric text values and number without conversions.
[Transaction Number] + 231955 will be equal 231957 if [Transaction Number] equal 000002 or 002
0
 
LVL 30

Expert Comment

by:hnasr
ID: 39777126
"need to add the number 231955 to the value from a query and have it display 231955.", where is the effect of value 000002?
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
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.

733 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