Tai Lung
Tai Lung

Reputation: 89

Dcount,Dmin,DMax,DAvg very slow to update on opening form

I have a form in Access with 6 text boxes. In these boxes I use expressions with DCount, DMax, DMin, DAvg. However it gets updates very slowly. How can I improve the pace? Is there an alternative for the Expressions

DCount("*";"FieldA")

in VBA or in any other SQLcode?

Upvotes: 0

Views: 399

Answers (2)

Gustav
Gustav

Reputation: 55816

If you pull from the same table (from "FieldA"), you create a query that pulls these values in one go:

Dim rs As DAO.Recordset
Set rs = CurrentDb.QueryDefs("YourQuery").OpenRecordset()

Me!AverageTextbox.Value = rs!AverageField.Value
Me!CountTextbox.Value = rs!CountField.Value
' etc.

Upvotes: 1

ClintB
ClintB

Reputation: 509

Perhaps you could look at making it a bound form?

If it already is a bound form then perhaps you could add those fields to the query the form is based upon. If its a bound form based upon a table then you could make a query instead with those extra fields.

Upvotes: 1

Related Questions