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

Better approach than Dcount to display total records? 2

Status
Not open for further replies.

Moss100

Technical User
Aug 10, 2004
584
GB
Hello I have a main menu form. On this i want to display the total number of records that match certain criteria.

For example.

From the tblProperty I would like to show

The number of properties that are 4 bed
The number of properties that have a garden etc

At present I have several unbound text boxes which perform a dcount on the tblProperty to return and display the data.

Is there a better (more efficient) way of doing this or is my method ok.

I'm looking at ways of trying to improve the speed that forms load etc.

Many thanks Mark.
 
My data is in SQL , so I farm heavy weight queries out to SQL Server and return a result of the data I need via a stored procedure.

Though the logic should still work locally.

Write a query that performs all the calculations and returns all the desired results, rather than attaching lots of small queries (DCounts) to multiple text boxes.

You can run the query then programmatically update all the textboxes with the values.

I have found using one query to make many calculations is quicker than running lots of small queries for each desired value, obviously SQL Server has built in query optimisation so that help with getting the values fast, and you can even create a view that provides these sorts of datasets if needs be.




"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Free Electronic Dance Music
 
Thanks as always. For ease I have gone with the ecount.

It seems a little faster and was easy to implement.

Many thanks Mark.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top