To reduce the length of the SQL statement, use the In() clause (as suggested in first reply by pbaldy above).
For example:
WHERE BookingsID In (25717, 25398, 25832, 25834, 25782, 24950)
To reduce the length of the SQL statement, use the In() clause (as suggested in first reply by pbaldy above).
For example:
WHERE BookingsID In (25717, 25398, 25832, 25834, 25782, 24950)
is there any reason why you would choose while over do?Close While using Wend
Close Do using Loop
Do While
Something
Loop
Do Until
Something
Loop
While
Something
Wend
These are the rules I use:
If you want to write code that you can exit a loop then use Do and Loop. If you do not write code in the loop to "Exit Do" then leave Do out entirely. Another reason to use Do is when you need to evaluate "Until".
My impression is that your VBA is compiled better and it is more efficient in RunTime.
I could be wrong. It is just a rule I follow. Do with Loop has the option to exit the loop with an Exit Do line of code. If Runtime has to anticipate this happening, slower performance.
If you have a lot of records and a stopwatch you can test it for us.
No particular reasons other than it's simple and I am comfortable with it and it works. And as ItsMe points out, don't need any exit strategy.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Thanks for the info guys