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.
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??
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
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.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.