VBA Query Best Practices advice needed

psycoperl

Active Member
Joined
Oct 23, 2007
Messages
339
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
  2. MacOS
  3. Web
Good Morning,
I need some advice on a project that I am working on.

I am trying to see Would running a single query and then iterating through each record multiple times to check for each error be better than running multiple queries where only problems are returned??

The scenario: As part of a mailing list generation process, we pull records that are supposed to be mailed into tblTempMailing for processing.
We then run error checks to ensure that the data in the letters is correct and formatted properly so that the letters don't get bounced or reciepents are unable to respond.
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
It's hard to say. If the error-checking involves a lot of string matching tests, you might have better luck going through a recordset and running the tests on each record in turn. But if it's simpler stuff like "zip code not null" then a query would probably be fastest, especially if the field were indexed. If the data set is fairly small then it probably makes little difference either way - I'd start with what is simplest, and see how it goes from there.
 
Upvote 0

Forum statistics

Threads
1,223,246
Messages
6,170,996
Members
452,373
Latest member
TimReeks

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