Query Efficency and Best Practice

psycoperl

Active Member
Joined
Oct 23, 2007
Messages
339
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
  2. MacOS
  3. Web
I am looking for both Best Practice and Best Efficency for doing a calculation

Is it faster to do simple calculations on two fields in SQL while running my query or in VBA after the query.
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
It probably really depends on exactly what you are trying to do, but if it really is a simple calculation that can be done in your query, then I think there should be no reason to involve VBA. VBA is a great tool, but no need to unnecessarily complicate matters when a simple solution will do.
 
Upvote 0
If performace is critical then I keep teh query as simple as possible. No caclulations.

I perform the calculatson at the form or report level. A lot of time this can be done in a control's control source without any VBA code.

PS:
"Give a man a fish, feed him for a day. Teach a man to fish, and he will sit in a boat a drink beer all day!"
 
Last edited:
Upvote 0
"Give a man a fish, feed him for a day. Teach a man to fish, and he will sit in a boat a drink beer all day!"

You say that like there's something wrong with that!:)
Actually, I am a fisherman, but am usually all business when I fish, which means no beer to slow me down. The beer usually comes when eating the fish dinner!;)
 
Upvote 0
If performace is critical then I keep teh query as simple as possible. No caclulations.

I perform the calculatson at the form or report level. A lot of time this can be done in a control's control source without any VBA code.

PS:
"Give a man a fish, feed him for a day. Teach a man to fish, and he will sit in a boat a drink beer all day!"


You say that like there's something wrong with that!:)
Actually, I am a fisherman, but am usually all business when I fish, which means no beer to slow me down. The beer usually comes when eating the fish dinner!;)

Thanks all... even for the fishing talk :-) ... reminds me it has been too long since I went fishing.
 
Upvote 0

Forum statistics

Threads
1,224,520
Messages
6,179,266
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top