Odd Issue with Adding Numbers from Fields into Unbound Field

Heatshiver

Registered User.
Local time
Tomorrow, 06:01
Joined
Dec 23, 2011
Messages
263
I have three fields that calculate different numbers from a query, then a fourth [unbound] field that adds them all together.

What ends up happening is the unbound field puts them all together instead of adding them together. Here is an example:

Field1 = 1
Field2 = 2
Field3 = 3
Field4 = 123

Even just with the simple expression [Field1]+[Field2]+[Field3], the above result occurs. I had originally thought it was because I was formatting the first three fields, but once I took that away the result was still the same...

Any help is much appreciated! Thanks.
 
The fields are text. Unlike numbers which are added arithmetically, text is concatenated by the plus sign.
 
What can I do to convert these to integers?
 
Set a numeric Format Property for the Controls (which I assume they are rather than Fields).

However if they are numbers they should be a numeric field type in the table and this will be passed along to the recordsource query of the form.
 
The fields are from a query. I have set the Format Property to be Fixed and at 2 decimal points. But this wouldn't work, so I applied the Format function to the fields in the recordsource query for the form to get the to display properly.

At the moment I tried this without success for the unbound field:

=CInt([VCDC1])+CInt([VCDC2])+CInt([VCDC3])

Any idea where I can go from here? Thank you for your replies.
 
Are the original fields numeric in the table the query is based on?
 
Yes. It's based off of two tables, and each calculation is purely of numbers.
 
What ended up working was using making an alias for the three fields and using Val on them. Then adding those aliases together in the unbound field.
 
That should be unnecessary if the fields in the original table are a numeric type. This behaviour has always been fundamental in Access.

I still believe at least one your original fields would have to be a text field type. Any text fields included in the expression or fields they are derived from (even if all the characters are numbers) will convert it to concatenation.

Can you post a cut down version of the database to demonstrate the error?
 

Users who are viewing this thread

Back
Top Bottom