R
Robert5833
Hi Tom,
This is great information, and I appreciate your time and guidance. For all
that I’ve read in the “formal†publications, I seem to get the most, and the
best “real world†context from this discussion group and those who support it.
Thanks again for your input and the help.
Comments in line below:
Good advice; and making the settings changes (I’ve seen that feature, but
just haven’t done it yet). And I'll be reading the linked material shortly.
Thanks!
Good advice; I’ve already disabled Auto Correct Names, but didn’t think
about this setting or what it meant.
Debugging; or better, the methods and techniques one uses to debug is
something I’m beginning to understand more clearly; and I’ve found the
Debug.Print and other uses of the Immediate Window very helpful tools.
This helps me understand the different approach much better. I did find that
when I changed to this technique, I was able to do a lot more with the
Immediate Window.
I am doing this routinely now in my procedures; and I can see the savings in
time it provides. I understand better now why and how it is done. Thank you!
I am doing this too. Thank you!
As always, I appreciate your help and your patience with me and others like
me; who are interested in learning the “tricks of the trade†even as we
struggle to understand.
Best regards,
Robert
This is great information, and I appreciate your time and guidance. For all
that I’ve read in the “formal†publications, I seem to get the most, and the
best “real world†context from this discussion group and those who support it.
Thanks again for your input and the help.
Comments in line below:
Tom Wickerath said:Hi Robert,
Here is a "gem tip" that I wrote on this subject. It also shows you how to
change the default behavior, so that all new modules you create will
automatically include these two very important words:
Always Use Option Explicit
http://www.access.qbuilt.com/html/gem_tips.html#VBEOptions
Good advice; and making the settings changes (I’ve seen that feature, but
just haven’t done it yet). And I'll be reading the linked material shortly.
Thanks!
While you're at it, you might as well remove the not-so-helpful auto index
"feature":
http://www.access.qbuilt.com/html/gem_tips.html#AutoIndex
Good advice; I’ve already disabled Auto Correct Names, but didn’t think
about this setting or what it meant.
No--the only real benefit is to aid in debugging.
Debugging; or better, the methods and techniques one uses to debug is
something I’m beginning to understand more clearly; and I’ve found the
Debug.Print and other uses of the Immediate Window very helpful tools.
I routinely set a string variable myself, rather than try to include the SQL
within the .execute method directly. And when I need to troubleshoot other's
databases that include db.execute "Some SQL String" (where "db" has
previously been set = CurrentDB), I usually go ahead and separate it out, so
that I can look at the SQL statement that results.
This helps me understand the different approach much better. I did find that
when I changed to this technique, I was able to do a lot more with the
Immediate Window.
I also tend to declare a database variable, and set it, like this:
Dim db as DAO.Database
Set db = CurrentDB()
so that I can use db.execute to run an action query. I generally prefer
doing that versus using CurrentDB.Execute, however, it doesn't really matter
performance wise, unless you have a need to reference CurrentDB more than one
time in the same procedure (for example, you have a procedure that runs
several action queries). In that case, setting the variable once and reusing
it will be faster versus making a call to CurrentDB each time.
I am doing this routinely now in my procedures; and I can see the savings in
time it provides. I understand better now why and how it is done. Thank you!
However, when you set a database variable, you should ensure that you also
set it equal to nothing as a part of the ExitProc part of your procedure.
I am doing this too. Thank you!
As always, I appreciate your help and your patience with me and others like
me; who are interested in learning the “tricks of the trade†even as we
struggle to understand.
Best regards,
Robert