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!

Calculated expressions

Status
Not open for further replies.

Shell123

Programmer
Mar 8, 2001
5
NZ
Is there anyone out there who can help with the above?? I have a few boxes, when I choose something in one box I want the other 2 boxes to calculate something resulting in a total.

Please let me know asap if you can help me

Thanks
Shelley from New Zealand
 
How about an example or two showing the contents of the box and what you expect to see (values/results/formulas) in the other boxes?

I'm sure someone can aid you upon seeing an example.


Dave
 
one easy way to do this is to set the Control source to something like

= [Rate] * [Quantity]

where [Rate] & [Quantity] are controls on on your form as they appear on the expression builder

there are other ways of course & if you need more help... we're game
 
I can send my db (compacted & zipped of course) and you can have a look at the subform and see what I mean.

When a combo-box action is chosen (there are about 8 choices in the combo-box) I want it to perform a specific calculation.

e.g if "mow" is picked then I want it to put in the cost of the clients lawn (info held in another text-box)e.g $25 in the unit price and then have a total.

if "mow-paid" is picked I want it calculate "cost of lawn" and subtract (behind the scenes) the cost of lawn. That sounds weird I know but it will work out.

If "paid" is picked then I want it to take e.g $25 off the total price.

Its probably easier if I send the db and then explain maybe??

Let me know.
 
Shell, Do you VBA?

If so, then you can put calculations into the after update event of the combo box. Something like

'Just for ideas
Private Sub MyComboBox_AfterUpdate()
Select Case Me.MyComboBox
Case "Mow"
Me.TotalPrice = Me.TotalPrice + 25
Case "Mow-Paid"
me.TotalPrice = me.TotalPrice - Me.CostOfLawn
Case "Paid"
Me.TotalPrice = Me.TotalPrice - 25
'More cases etc.
End Select
End Sub

How's that for a start
 
Eeek, sorry I dont know VB. Can you possibly tell me how to do by going into properties and "Build expressions"???

Shelley
 
Sorry, I rely (too?) heavily on VBA. But there are others who may be able to help.
 
What you're trying to do is tatamount to storing calculated results in your table rather than record each transaction and then add or subtract each based on the type of transaction it is to get a total. With few exceptions storing calculated results goes against the Forms of Data Normalization. It also wreaks havoc on trying to maintain the integrity of your data. It is far easier to capture each transaction and calculate the totals on demand everytime from clean unadulterated data.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top