A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Adding Multiple Fields



 
 
Thread Tools Display Modes
  #1  
Old October 29th, 2009, 01:24 AM posted to microsoft.public.access.forms
dcrqueens
external usenet poster
 
Posts: 28
Default Adding Multiple Fields

I am trying to add 3 fields in a form using an unbound text box as follows:
=Nz(RES,0)+(Nz(CRE,0). The formula simply takes what is in the field and puts
them together in the unbound text box. So if there is the following RES 2,
CRE 3, I get 23 in the unbound text box. Can someone please tell me when I am
going wrong?
  #2  
Old October 29th, 2009, 02:13 AM posted to microsoft.public.access.forms
Allen Browne
external usenet poster
 
Posts: 11,706
Default Adding Multiple Fields

If 2 + 3 = 23, then you want concatenation, not addition.

Try & as the concatenation operator:
=[RES] & [CRE]

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


"dcrqueens" wrote in message
...
I am trying to add 3 fields in a form using an unbound text box as
follows:
=Nz(RES,0)+(Nz(CRE,0). The formula simply takes what is in the field and
puts
them together in the unbound text box. So if there is the following RES 2,
CRE 3, I get 23 in the unbound text box. Can someone please tell me when I
am
going wrong?


  #3  
Old October 29th, 2009, 02:31 AM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Adding Multiple Fields

On Wed, 28 Oct 2009 17:24:11 -0700, dcrqueens
wrote:

I am trying to add 3 fields in a form using an unbound text box as follows:
=Nz(RES,0)+(Nz(CRE,0). The formula simply takes what is in the field and puts
them together in the unbound text box. So if there is the following RES 2,
CRE 3, I get 23 in the unbound text box. Can someone please tell me when I am
going wrong?


It's treating the values as text strings (for which + is a concatenation
operator) rather than as numbers. Try

=Val([Res]) + Val([CRE])

--

John W. Vinson [MVP]
  #4  
Old October 29th, 2009, 02:43 AM posted to microsoft.public.access.forms
roccogrand
external usenet poster
 
Posts: 188
Default Adding Multiple Fields

When I place an unbound textbox on a form, I have to be sure that all the
fields are numbers or currency if summation is what I want. If RES and CRE
are defined as text strings but you store numbers in them then convert the
text, e.g., 2, 4, or 9 to numbers and see if that works.

HTH

David

"dcrqueens" wrote:

I am trying to add 3 fields in a form using an unbound text box as follows:
=Nz(RES,0)+(Nz(CRE,0). The formula simply takes what is in the field and puts
them together in the unbound text box. So if there is the following RES 2,
CRE 3, I get 23 in the unbound text box. Can someone please tell me when I am
going wrong?

  #5  
Old October 29th, 2009, 03:13 AM posted to microsoft.public.access.forms
Arvin Meyer [MVP][_2_]
external usenet poster
 
Posts: 2,310
Default Adding Multiple Fields


"dcrqueens" wrote in message
...
I am trying to add 3 fields in a form using an unbound text box as follows:
=Nz(RES,0)+(Nz(CRE,0). The formula simply takes what is in the field and
puts
them together in the unbound text box. So if there is the following RES 2,
CRE 3, I get 23 in the unbound text box. Can someone please tell me when I
am
going wrong?


Sounds like an Abbott & Costello routine. What's happening is that you are
adding text. "2"+"3" = 23 If necessary, try forcing the numerics:

= CDbl(Nz(RES,0))+CDbl(Nz(CRE,0))
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


  #6  
Old October 29th, 2009, 12:46 PM posted to microsoft.public.access.forms
dcrqueens
external usenet poster
 
Posts: 28
Default Adding Multiple Fields

Thank you all. I was able to get the field to work. I used
=Nz(RES,0)+(Nz(CRE,0).

"Arvin Meyer [MVP]" wrote:


"dcrqueens" wrote in message
...
I am trying to add 3 fields in a form using an unbound text box as follows:
=Nz(RES,0)+(Nz(CRE,0). The formula simply takes what is in the field and
puts
them together in the unbound text box. So if there is the following RES 2,
CRE 3, I get 23 in the unbound text box. Can someone please tell me when I
am
going wrong?


Sounds like an Abbott & Costello routine. What's happening is that you are
adding text. "2"+"3" = 23 If necessary, try forcing the numerics:

= CDbl(Nz(RES,0))+CDbl(Nz(CRE,0))
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:21 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.