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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I add controls in a form? 2

Status
Not open for further replies.

ov3rdr1ve

IS-IT--Management
Oct 20, 2004
32
US
I have 4 controls that have a number value that I would like to add up.

The thing is I would like to have them add up per record. Since each record will have different values on the controls, I want the added up value to change when you change the record.

I have this working by doing a DSum on fields in the table, but it just continually adds the fields for all the records insead of just the values for each record?

Hope that makes Sence...
od~
 
How are ya ov3rdr1ve . . . . .

Add an [blue]unBound Textbox[/blue] to the [blue]details section[/blue] and in the [purple]ControlSource[/purple] property copy/paste the following:
Code:
[blue] = Textbox1Name + Textbox2Name + Textbox3Name + Textbox4Name[/blue]

Calvin.gif
See Ya! . . . . . .
 
What the AceMan suggested does add the values togather, it simply concatinates them. IF you want the values added you need to convert the text values to integers (or whatever number type you need.

Ex.: In the contol source do this : (Converting charter values to integers)

=CInt([textbox1].Value) +CInt([textbox2].Value) + CInt([textbox3].Value) + CInt([textbox4].Value)


Then you can open your table and write the value of the total to what ever field you need. It's also considered bad design to keep totals in your db, but dependingon what I use the totals for, I sometimes keep them anyways.
 
ov3rdr1ve said:
[blue]What the AceMan suggested does add the values togather, [purple]it simply concatinates them.[/purple][/blue]
Apparently you've never tried it!. If you do, you'll find its [purple]coerced properly[/purple], [blue]even across different numeric data types . . . .[/blue]

[blue]Cheers![/blue]

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top