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

event after counting records on filtered form? 2

Status
Not open for further replies.

AlexmacG

Technical User
Jan 16, 2003
50
GB
Any method or code to solve this problem appreciated.

From large tables we are dislaying filtered records on a form which shows the records corresponding to a users selection - which must be a common activity for a dbase?. We wish to take VBA code action depending on the number of records displayed to inform the user the number of records selected via another form and related information.

Speed is critical due to large numbers of potential records filtered/counted hence we are using the filter rather than a query which seems to speed things up enormously.

Process to date is: user enters selection criteria on one form, commands load of results form (one of several)which has filter set via code triggered from the form's on load event, to display the resulting records.

We have updated an text field (calculated control = record count) on the results form ( which is rather slow relative to filter!) but do not know a method to catch the event as we understand there is no AfterUpdate event for a calculated control.

Any ideas or sample form/code? Can the filtered records on the form be used as a recorset object and is so type please.

TIA
Alex
 
I played with this a little bit - the best suggestion I have would be to create a global variable to store the calculated value. Then, in the ON ACIVATE event of the form you are populating with this filtered data, check to see if the stored variable matches the current calculated value - if not, do whatever you need to do. If you are populating the form as it loads with your filtered data, then the data (and calculated control) will be refreshed, and at that point you could check the current calculated controls value against the stored variable value and if there is a change - fire your code.

Not sure if this will help - good luck

Tina
 
Thanks Tina, will have a look at your suggestion.
 
Problem now solved.

Use the forms Current Event to run code to clone forms record set and count records. Calculated text box for record count not required.

.......easy when you know how.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top