Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding a few text boxes together 1

Status
Not open for further replies.

AidanEnos

MIS
Dec 11, 2000
189
Ok - It's been a while and I'm missing something silly - I know it.

So, I'm on record 4 in my Customer Order form, there are 5 fields in a row and I want to have the user input the values and total in a text box underneath. Simple? I've tried to set the control source to =Sum([a]+) and it adds them alright - for those fields in all records in the whole database. A little more than I'd hoped.

All I want is to have a running total of a list of boxes on an order form - for the current record only.
 
If I understand you correctly then in the underlying query you simply want an extra field set to:
TotalField:=[a]++[c]+[d]

RuralGuy (RG for short) aka Allan Bunch MS Access MVP acXP winXP Pro
Please respond to this forum so all may benefit
 

Allan's method will work if you want to go the query route (it's actually how I'd do it) but as to why your method didn't work: It did! The answer you got is what the Sum() function is meant to do! What you wanted to do, setting it as the Control Source in the Property Box, should have been

=[A] +

without the Sum in the mix!

But that leaves a problem; what if one of the boxes has no value in it? That means it's Null and Null plus anything is Null! So you'd have to use the Nz() function as well. Something like

=Nz([A],0)+ Nz(,0)

Now any empty (Null) box will be converted to zero and the equation will reflect this. Zero plus anything = anything, not Null.

The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top