code not running on initial open

  • Thread starter Thread starter Abbarition
  • Start date Start date
A

Abbarition

When I open a database, and then open a form, the code
connected to my command buttons does not run. It is like
there is nothing set for the OnClick event. However, if
I close the form and then reopen it, all the code works
correctly. I only encounter this problem the first time
the form is opened. I am working in Access 2000 and the
database MAY have originally been created in Access 97
and converted to 2000.

Does anyone have any suggestions as to why this is
happening?
Thanks!
 
Is there some sort of code that Enables the command button. I would look to
see if your form has soemthing that is turning this off. There might be
code to turn it back on but that isn't getting triggered until you close the
form so that it will be enabled the next time. Look through all your code
for something likecmdButton.Enabled = False. Or check the initial Enabled
property of the button.

Kelvin Lu
 
I am experiencing the same problem intermittently (i.e. several times
per day), but it is not limited only to command buttons...NONE of the
code behind my startup form runs the first time the form is opened,
even the Form_Open code. If I close and re-open the form or exit and
re-launch Access the code runs perfectly, but this is obviously
inconvenient, only solves the problem temporarily, and will not be
possible for my end users to do. I've tried unlinking and relinking
references, compacting and repairing the database, putting debug.print
statements in the code to see if it's actually running (it's not), and
trying an Autoexec macro, but nothing solves the problem. The database
is a MS-Access 2000 database I built from scratch (i.e. it's not
converted from a previous version of Access), using DAO 3.6.
References I'm using are: Visual Basic for Applications, Microsoft
Access 9.0 Object Library, OLE Automation, Microsoft Scripting Runtime,
and Microsoft DAO 3.6 Object Library.

Any suggestions?

Jim
 
Back
Top