Adding result of list box to Text box (1 Viewer)

ypma

Registered User.
Local time
Today, 11:56
Joined
Apr 13, 2012
Messages
643
Please point me in the right direction .
i have the results of four separate list boxes in four separate text boxes, No problem. I Now wish to add or sum of the four totals into one text box .

i have tried the following in the control source of the text box :
# =Nz([List341].Column(0))+Nz([List346].Column(0))+Nz([List929].Column(0))+Nz([List931].Column(0))#
and receive and invalid syntax error

Am i going about this the wrong way ?

Regards Ypma
 

theDBguy

I’m here to help
Staff member
Local time
Today, 04:56
Joined
Oct 29, 2018
Messages
21,357
Hi. Did you actually have the hashtags in your expression? If so, maybe that's why you were getting a syntax error.
 

Mark_

Longboard on the internet
Local time
Today, 04:56
Joined
Sep 12, 2017
Messages
2,111
Rather than reference [List341], try Me.List341.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 04:56
Joined
Oct 29, 2018
Messages
21,357
Rather than reference
[List341], try Me.List341.
That would probably produce an error in the Control Source of a Textbox. I think...
 

Mark_

Longboard on the internet
Local time
Today, 04:56
Joined
Sep 12, 2017
Messages
2,111
Give ?Name, but not a big issue. Was thinking in code.

What WILL happen, is if you don't tell NZ what to return you don't get what you expect. You also have to be careful since text boxes are treated as strings, so you wind up concatenating if your not careful.
 

ypma

Registered User.
Local time
Today, 11:56
Joined
Apr 13, 2012
Messages
643
Thank you for your response. 1 TheDbguy the Hashtag are not part of the control source ,referencing the control source with me.listbox was not accepted.
Mark, i think you have a point , as the result I receive from my effort is indeed concatenating, So how i can i avoid that. The results of the list boxes are Currency. I added the NZ as two of the fields were null, in the case i am working on. Your further advise would be appreciated

Regards Ypma
 

Mark_

Longboard on the internet
Local time
Today, 04:56
Joined
Sep 12, 2017
Messages
2,111
I would try using EVAL after concatenating your NZ's and your additions signs to make a proper string. Should look like the below;

Code:
=EVAL(Nz([List341].Column(0),0) & "+" & Nz([List346].Column(0),0) & "+" & Nz([List929].Column(0),0) & "+" & Nz([List931].Column(0),0))

I'd also rename your Lists to be more user friendly. List341 conveys little information while ListAmountIPay makes much more sense.
 

ypma

Registered User.
Local time
Today, 11:56
Joined
Apr 13, 2012
Messages
643
Mark_ Thank you very much, your solution worked without the EVAL without any problems ,putting inverted commas around the + sign and the extra zero after the column.(0),0) did the trick.
Regards Ypma
 

Mark_

Longboard on the internet
Local time
Today, 04:56
Joined
Sep 12, 2017
Messages
2,111
Your very welcome!
 

theDBguy

I’m here to help
Staff member
Local time
Today, 04:56
Joined
Oct 29, 2018
Messages
21,357
Mark_ Thank you very much, your solution worked without the EVAL without any problems ,putting inverted commas around the + sign and the extra zero after the column.(0),0) did the trick.
Regards Ypma
Hi. Glad to hear you got it sorted out. Good luck with your project.
 

Users who are viewing this thread

Top Bottom