Command Button Wizard

M

majordud

Using Access 2000, I have built an extensive database, & the command buttons
built with the Wizard all work. All simple commands, such as Print, Find
Record, etc. I build another database (ostensibly with all the same
settings) and the command buttons built with the Wizard will not work - none
of them - when clicking on such a button, it depresses, but nothing happens.
I build another database, and the command buttons built with the Wizard all
work. Why? What variable is available that apparently switches off all the
buttons? The macro code established by the Wizard in a db that works is
identical to the macro code in the db that doesn't work.
Suggestions?
 
A

Allen Browne

Perhaps it is a security setting.
In Access 2003, go to Tools | Macro | Security, and set the Macro security
to Low.
In Access 2007, make sure the database is in a trusted location via:
Office Button | Access Options | Trust Center | Trust Center Settings

Alternatively, there could be a problem with library references in the db
where it doesn't work. For solving problems with references, see:
http://allenbrowne.com/ser-38.html

To help track down what's wrong, you need to be able to see your error
messages. In the code window, go to:
Tools | Options | General
and set Error Trapping to "Break on Unhandled Errors."
In the options of the main Access window, make sure you have not disabled
Special Keys in the startup.
 
M

majordud

Thanks for your reponse, but as stated, I am using Access 2000 - perhaps you
could tailor your comments more specifically for 2000?
 
M

majordud

When I drop down the Tools/Macro menu in my Access 2000, I have options of
only Visual Basic Editor, or Run Macro - if I drop down the Tools/Security
menu, I have options of Set Database Password, User and Group Permissions or
Accounts, User Level Security Wizard, or Encrypt/Decrypt Database - these do
not give me the ability to change a macro security level, and nowhere else
do I see the ability to change the macro security level to anything. But
even if I did have such an option, I can guarantee that I never changed it -
so why is there the difference between the databases? What have I done wrong
(if I did)? and how do I fix it? I just created a new test db & the buttons
from the wizard work just fine - they won't in my previous db, and they do in
the db previous to that. What have I changed?
 
B

BruceM

I don't know the answer to your questions. I was just trying to help you
find the place to check Macro security. If Security is not on the Macros
sub-menu you may be able to place it there as follows:
Click Tools > Customize. Select the Commands tab. Select Tools on the
left-hand menu, and find Security on the right-hand menu. Drag Security to
Tools (don't let go yet) on the menu bar. When the drop-down menu appears,
drag it to Macro, then drop it in the sub-menu when that appears. Close the
Customize dialog box. Security should now be available on the Macro
sub-menu.
I am basing this method on Access 2003. I used to have Access 2000, but I
can't recall the details of the interface, so it is possible my suggestion
will not apply, but I think they were about the same as far as the menus
went.
Allen's other suggestions apply to Access 2000 as well as 2003.

majordud said:
When I drop down the Tools/Macro menu in my Access 2000, I have options of
only Visual Basic Editor, or Run Macro - if I drop down the Tools/Security
menu, I have options of Set Database Password, User and Group Permissions
or
Accounts, User Level Security Wizard, or Encrypt/Decrypt Database - these
do
not give me the ability to change a macro security level, and nowhere
else
do I see the ability to change the macro security level to anything. But
even if I did have such an option, I can guarantee that I never changed
it -
so why is there the difference between the databases? What have I done
wrong
(if I did)? and how do I fix it? I just created a new test db & the
buttons
from the wizard work just fine - they won't in my previous db, and they do
in
the db previous to that. What have I changed?
 
A

Allen Browne

Darn: I missed the version number! And it was right at the beginning of your
post.

A2000 doesn't have the Macro Security issue, so something else is wrong.

Try this sequence (in order):

1. Uncheck the boxes under:
Tools | Options | General | Name AutoCorrect
Explanation of why:
http://allenbrowne.com/bug-03.html

2. Compact the database:
Tools | Database Utilities | Compact/Repair

3. Close Access. Make a backup copy of the file. Decompile the database by
entering something like this at the command prompt while Access is not
running. It is all one line, and include the quotes:
"c:\Program Files\Microsoft office\office\msaccess.exe" /decompile
"c:\MyPath\MyDatabase.mdb"

4. Open Access (holding down the Shift key if you have any startup code),
and compact again.

5. Open a code window.
Choose References from the Tools menu.
Uncheck any references you do not need.
Compare the checked references with the ones checked in the databases that
do work: any differences?
For a list of the ones you typically need in your version of Access, see:
http://allenbrowne.com/ser-38.html

6. Still in the code window, choose Compile from the Debug menu.
Fix any errors, and repeat until it compiles okay.

7. Still in the code window, choose Options on the Tools menu. On the
General tab, make sure Error Trapping is set to:
Break on Unhandled Errors
and the Compile on Demand is unchecked.

At this point, you should have a database where the name-autocorrect errors
are gone, the indexes are repaired, inconsistencies between the text- and
compiled-versions of the code are fixed, reference ambiguities are resolved,
the code syntax is compilable, and the VBA options are set to show errors
and avoid this kind of corruption.
 
G

gllincoln

Access 2000 is a quite a bit different on the security side - it leans
mostly on the user security group policy aspects that were dropped in Access
2007.

This may seem like a silly question - but have you tried running a compact
and repair on the errant database?

Taken as a group, the information you have provided regarding before working
and an after working - it seems almost certain that the problem is not
within Access the Program. The problem is (almost certainly) contained in
the database ie the specific mdb file.

Another avenue to explore -

If some code is attempting to execute and winds up in an endless loop or
wait state or at a 'break' point, nothing else is going to execute (ie the
code behind the buttons won't fire). For example, do you have an autostart
form with an open or on load or activate procedure hooked up?

You might try loading the database in question while depressing the left
shift key - which suppresses code that normally runs automatically when you
first open the database. See if the command buttons work when starting this
way?

Hope this helps...

Gordon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top