Edit Command Button Wizard

J

Joe

Hi All,

I was wondering if there was a way to edit the command button wizard?

Whenever I create a Command Button from a wizard, I end up having to further
edit the code manually.

Thanks in advance,


joemach
 
V

Van T. Dinh

So, no AFAIK.

I hardly use the CommandButton Wizards as some of the codes created are so
outdated (e.g. DoMenuItem) and I prefer my own error-trapping format.
 
J

Joe

Thanks Van,

I copy that. I have learn to hate "On Error Resume Next' which is the
default error handler. I need to re do the error handler on almost all
events.

So do you manually write your own code or use some sort of template?

Could I set up my own wizard or template? Not so much that I don't want to
write the code, but sometimes my coding mind gets ahead of my fingers and
when I compile, I have several errors that are just typos. Kind of a pain.


TIA,

joemach
 
A

Allen Browne

Joe, I agree with Van.

We use an add-in called MZTools. Downloadable from www.mztools.com. You can
define what you want as an error handler, and click a toolbar button to drop
it in to your procedure. You soon outgrow the wizard, and find it easier to
write your own code to do things like explicitly saving the record in the
form so you don't lose it when closing.

We also found that users will not write down their errors and tell you, so
it is useful to actually log the errors. If you are interested in that idea,
see:
http://members.iinet.net.au/~allenbrowne/ser-23a.html
 
J

Joe

Thanks Allen,

I am beginning to experience those 'growing pains' right now. The wizard is
a good 'quick start' but does not cover all the bases on what can go wrong
(or what the end user can attempt to enter in a date/time textbox).

Thanks for the tip on MZ Tools. I use it in my VB6 environment but can't in
Access97. Why Access97, you ask? Good question. It always worked best for
me to always have the lowest possible version that way I could always get
the project started and upgrade to the clients' machine for the last few
tweaks. Besides I was very comfortable with 97 and hear a lot of problems
with 2K &XP. But am looking to move to 2003 Developer Edition in near
future.

Very nice Error_Log Function. A great idea.

That's for the tips and sharing your knowledge with me.

joemach
 
6

'69 Camaro

Hi, Joe.

As Allen suggests, you're better off using a tool such as MZTools for the
code generation than the Command Button Wizard, which uses VBA 4.0 (Access
95). It doesn't look to me like it's _ever_ been updated, even in Access
2003.

You can edit the code for the Command Button Wizard, but it's probably not a
good idea. Your modifications may not be enough to prevent your having to
edit the resulting Wizard-generated code -- just to get it to compile --
because some of it appears to be "hard coded" within the Wizard, and is
unaffected by your changes to records in the table.

However, if you feel adventurous and you'd like to edit the code manually
for Access 97, then much of the code is stored in the "Declarations" and
"Body" fields of the bw_TblBtnActions table in the WZMAIN80.MDE Wizard file
in the same directory as MSAccess.EXE. For Access 2K or later versions,
this table is in the ACWZDAT.MDT Wizard file. You can add your error
handler routine in the "ErrHandler" field for these records to replace most
of the Wizard-generated code for the default error handler.

HTH.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address, so that a message
will be forwarded to me.)
 
Top