INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Better approach than Dcount to display total records?

Better approach than Dcount to display total records?

(OP)
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.

RE: Better approach than Dcount to display total records?

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

RE: Better approach than Dcount to display total records?

(OP)
Thanks as always. For ease I have gone with the ecount.

It seems a little faster and was easy to implement.

Many thanks Mark.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close