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

Updating calculate control as you type? 2

Status
Not open for further replies.

djayam

Technical User
Aug 16, 2005
95
GB
Hi all,

I have a control "Quantity", a control "UnitPrice", and a control "TotalPrice". In the AfterUpdate of "UnitPrice" I have "TotalPrice" = "UnitPrice" * "Quantity". Works no problem. I wondered, however, if there was a way TotalPrice could be recalculated with every key-press in UnitPrice so it updates "as you type".

Anyone know how?

Cheers,

Jason
 
Heve you tried the onchange event of a control? Regards
 
How are ya djayam . . .

Agree with ZOR on use of the [blue]OnChange[/blue] event. You'd caputre input thru the [blue]Text[/blue] property of the control, convert to numeric and perform the calculation.
Code:
[blue]   Me!TextboxName = Val(Me!UnitPrice.[purple][b]Text[/b][/purple]) * Me!Quantity[/blue]
[blue]But what would be the point of this?[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see FAQ219-2884:
 
Something like this.

Private Sub txtUnitPrice_Change()
Me.Recalc
End Sub

Private Sub txtQuantity_Change()
Me.Recalc
End Sub
 
Perfect - thanks ZOR and AceMan. Not an essential feature AceMan but I know the client and it'll go down well.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top