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

Form doesn't recalculate 1

Status
Not open for further replies.

jeffbrubaker

Technical User
Oct 14, 2004
2
US
I have a form with subforms built from underlying queries. The form doesn't recalculate until after I leave Access, which could cause problems. Any way to get the form to recalculate immediately?
 
How are ya jeffbrubaker . . . . .

For each form:

[purple]Me.Requery[/purple] will cause calculations in queries & SQL to update.

[purple]Me.Recalc[/purple] will cause textboxes with calculations to [purple]ReCalc[/purple].

Calvin.gif
See Ya! . . . . . .
 
what about unbound calculations? can you have automatic recalculation of say for example a form displaying the running sum of a quantity???? assuming when entering the current quantity per month in a bound textbox, an unbound textbox will give me immediately a calculation result of the total quanity as a running sum??
 
Three textboxes
rate, qty, result
you will get the amount as soon as change qty or rate.
Code:
Private Sub qty_Change()
Me.result.SetFocus
Me.result.Text = Me.rate * Me.qty
Me.qty.SetFocus
End Sub
'================================
Private Sub rate_Change()
Me.result.SetFocus
Me.result.Text = Me.rate * Me.qty
Me.rate.SetFocus
End Sub
regards

Zameer Abdulla
 
GreekPatriot . . . . .

Exactly! ReCalc is [purple]mainly for updating unbound controls set to calculations.[/purple] Its needed if for example its result is dependent on amother control, [purple]you just edited![/purple]

Calvin.gif
See Ya! . . . . . .
 
So assume that the Running sum of the quantity is the textbox with a formula like this TotalQuantityTo-Date:
=DSum("[QUANTITY]","T_INVOICES","[CONTRACTNO] = '" & [ContractNo] & "' and [SECTIONNo] = '" & [SECTIONNo] & "' and [INVOICENo] <= " & [INVOICENo])

how would you get the result of this formula to be updated when you enter a new quantity?

Private Sub qty_Change()

can you give me a detail explanation on the example above??
 
sorry it should start like this
Private Sub Quantity_Change()


End Sub
 
ok I got your drify now. Hey this is excelent. It works the way I would have never imagined.

Private Sub Quantity_AfterUpdate()
Me.Requery
End Sub

Cheers TheAceMan1
 
GreekPatriot said:
[blue]It works the way I would have never . . .[/blue]
[purple]Yeah! . . . . . and you have control! . . . .[/purple]

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

Part and Inventory Search

Sponsor

Back
Top