Errors loading/opening forms using command buttons

S

Stephen @ ZennHAUS

Hi Guys and Gals

I have a database that was originally created in Access 2000, then modified
in 2003 before I got it. I have since upgraded it to a 2003 format file and
it has since been modified in both Access 2003 and 2007 depending on what I
was doing.

All of the original objects have been deleted after migrating old data to
new tables to remove design flaws.

Finally, I am at the stage of creating forms. I created a couple of minor
forms in Access 2007 along with the main menu which is just a blank form
that I have added buttons to. The forms works fine in Access 2007, but when
opened in Access 2003 on the same computer, Access 2003 fails and shuts
down. So, I deleted the forms from 2007 and recreated them in Access 2003.
It doesn't crash anymore, but I get the following error.

"Microsoft Office Access

The expression On Click you entered as the event property setting produced
the following error: A problem occurred while Microsoft Office Access was
communicating with the OLE server or ActiveX Control.

*The expression may not result in the name of a macro, the name of a
user-defined function, or [Event Procedure].
*There may have been an error evaluation the function, event, or macro."

It includes a Show Help >> button and an OK button.

The detail in the Show Help>> button says:

Visual Basic for Applications (VBA) encountered a problem while attempting
to access a property or method. The problem may be one of the following:
* A reference is missing.
* For help restoring missing references, see the Microsoft Knowledge Base
article 283806.
* An Expression is misspelled.
* Check all expressions used in event properties for correct spelling.
* A user-defined function is declared as a sub or as a private function in a
module.
* Expressions can resolve a user-defined function only if the function is
declared as one of the following:
* A public function in a module
* A public or private function in a code module of the current form or
report
* Security in Access is set to Medium or High and the Microsoft Jet 4.0 SP8
update is not installed.
* A more recent version of Jet 4.0 must be installed for Access to function
properly when security is set to Medium or High. To obtain the latest
version of Microsoft Jet, go to Windows Update.

I have already checked the references in the VBA project and they are as
follows:
* Visual Basic for Applications
* Microsoft Access 11.0 Object Library
* Microsoft DAO 3.6 Object Library
* Microsoft ActiveX Data Objects 2.1 Library
* OLE Automations

I have also changed the security to Low and made sure that Jet 4.0 is up to
date. The code syntax matches that of reference guide and in fact the code
was written by the Button control wizard.

The code is as follows:

Private Sub cmdProduction_Click()
On Error GoTo Err_cmdProduction_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmProduction"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_cmdProduction_Click:
Exit Sub

Err_cmdProduction_Click:
MsgBox Err.Description
Resume Exit_cmdProduction_Click

End Sub

I also changed it to the following to simplify it in the hope that would
make a difference.

Private Sub cmdProduction_Click()
On Error GoTo Err_cmdProduction_Click

DoCmd.OpenForm "frmProduction"

Exit_cmdProduction_Click:
Exit Sub

Err_cmdProduction_Click:
MsgBox Err.Description
Resume Exit_cmdProduction_Click

End Sub

This is really doing my head in because I have done all of this countless
times before and it has always worked. I have even tried this on other
computers with only Access 2003 and I have tried other projects I have built
in the past that worked and it all fails.

I know it's a lot that I have written, but I wanted to provide as much
detail as possible.

Cheers,

Stephen @ ZennHAUS
 
B

banem2

Hi Guys and Gals

I have a database that was originally created in Access 2000, then modified
in 2003 before I got it. I have since upgraded it to a 2003 format file and
it has since been modified in both Access 2003 and 2007 depending on whatI
was doing.

All of the original objects have been deleted after migrating old data to
new tables to remove design flaws.

Finally, I am at the stage of creating forms.  I created a couple of minor
forms in Access 2007 along with the main menu which is just a  blank form
that I have added buttons to. The forms works fine in Access 2007, but when
opened in Access 2003 on the same computer, Access 2003 fails and shuts
down. So, I deleted the forms from 2007 and recreated them in Access 2003..
It doesn't crash anymore, but I get  the following error.

"Microsoft Office Access

The expression On Click you entered as the event property setting produced
the following error: A problem occurred while Microsoft Office Access was
communicating with the OLE server or ActiveX Control.

*The expression may not result in the name of a macro, the name of a
user-defined function, or [Event Procedure].
*There may have been an error evaluation the function, event, or macro."

 It includes a Show Help >> button and an OK button.

The detail in the Show Help>> button says:

Visual Basic for Applications (VBA) encountered a problem while attempting
to access a property or method. The problem may be one of the following:
* A reference is missing.
* For help restoring missing references, see the Microsoft Knowledge Base
article 283806.
* An Expression is misspelled.
* Check all expressions used in event properties for correct spelling.
* A user-defined function is declared as a sub or as a private function in a
module.
* Expressions can resolve a user-defined function only if the function is
declared as one of the following:
    * A public function in a module
    * A public or private function in a code module of the current form or
report
* Security in Access is set to Medium or High and the Microsoft Jet 4.0 SP8
update is not installed.
* A more recent version of Jet 4.0 must be installed for Access to function
properly when security is set to Medium or High. To obtain the latest
version of Microsoft Jet, go to Windows Update.

I have already checked the references in the VBA project and they are as
follows:
* Visual Basic for Applications
* Microsoft Access 11.0 Object Library
* Microsoft DAO 3.6 Object Library
* Microsoft ActiveX Data Objects 2.1 Library
* OLE Automations

I have also changed the security to Low and made sure that Jet 4.0 is up to
date. The code syntax matches that of reference guide and in fact the code
was written by the Button control wizard.

The code is as follows:

Private Sub cmdProduction_Click()
On Error GoTo Err_cmdProduction_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "frmProduction"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_cmdProduction_Click:
    Exit Sub

Err_cmdProduction_Click:
    MsgBox Err.Description
    Resume Exit_cmdProduction_Click

End Sub

I also changed it to the following to simplify it in the hope that would
make a difference.

Private Sub cmdProduction_Click()
On Error GoTo Err_cmdProduction_Click

    DoCmd.OpenForm "frmProduction"

Exit_cmdProduction_Click:
    Exit Sub

Err_cmdProduction_Click:
    MsgBox Err.Description
    Resume Exit_cmdProduction_Click

End Sub

This is really doing my head in because I have done all of this countless
times before and it has always worked. I have even tried this on other
computers with only Access 2003 and I have tried other projects I have built
in the past that worked and it all fails.

I know it's a lot that I have written, but I wanted to provide as much
detail as possible.

Cheers,

Stephen @ ZennHAUS

Hi,

Try to create new DB in Access 2003 and import all the objects from
your database. Then, switch to VBA (CTRL+G), add DAO reference if
needed (Tools\References), and run Debug\Compile. Looks like that
either one of the objects is damaged, db is damaged or Access 2007
have added one of the new properties which Access 2003 does not
recognize (Unknon property).

Regards,
Branislav Mihaljev
Microsoft Access MVP
 
S

Stephen @ ZennHAUS

Hi Guys and Gals

I have a database that was originally created in Access 2000, then
modified
in 2003 before I got it. I have since upgraded it to a 2003 format file
and
it has since been modified in both Access 2003 and 2007 depending on what
I
was doing.

All of the original objects have been deleted after migrating old data to
new tables to remove design flaws.

Finally, I am at the stage of creating forms. I created a couple of minor
forms in Access 2007 along with the main menu which is just a blank form
that I have added buttons to. The forms works fine in Access 2007, but
when
opened in Access 2003 on the same computer, Access 2003 fails and shuts
down. So, I deleted the forms from 2007 and recreated them in Access
2003.
It doesn't crash anymore, but I get the following error.

"Microsoft Office Access

The expression On Click you entered as the event property setting
produced
the following error: A problem occurred while Microsoft Office Access was
communicating with the OLE server or ActiveX Control.

*The expression may not result in the name of a macro, the name of a
user-defined function, or [Event Procedure].
*There may have been an error evaluation the function, event, or macro."

It includes a Show Help >> button and an OK button.

The detail in the Show Help>> button says:

Visual Basic for Applications (VBA) encountered a problem while
attempting
to access a property or method. The problem may be one of the following:
* A reference is missing.
* For help restoring missing references, see the Microsoft Knowledge Base
article 283806.
* An Expression is misspelled.
* Check all expressions used in event properties for correct spelling.
* A user-defined function is declared as a sub or as a private function
in a
module.
* Expressions can resolve a user-defined function only if the function is
declared as one of the following:
* A public function in a module
* A public or private function in a code module of the current form or
report
* Security in Access is set to Medium or High and the Microsoft Jet 4.0
SP8
update is not installed.
* A more recent version of Jet 4.0 must be installed for Access to
function
properly when security is set to Medium or High. To obtain the latest
version of Microsoft Jet, go to Windows Update.

I have already checked the references in the VBA project and they are as
follows:
* Visual Basic for Applications
* Microsoft Access 11.0 Object Library
* Microsoft DAO 3.6 Object Library
* Microsoft ActiveX Data Objects 2.1 Library
* OLE Automations

I have also changed the security to Low and made sure that Jet 4.0 is up
to
date. The code syntax matches that of reference guide and in fact the
code
was written by the Button control wizard.

The code is as follows:

Private Sub cmdProduction_Click()
On Error GoTo Err_cmdProduction_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmProduction"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_cmdProduction_Click:
Exit Sub

Err_cmdProduction_Click:
MsgBox Err.Description
Resume Exit_cmdProduction_Click

End Sub

I also changed it to the following to simplify it in the hope that would
make a difference.

Private Sub cmdProduction_Click()
On Error GoTo Err_cmdProduction_Click

DoCmd.OpenForm "frmProduction"

Exit_cmdProduction_Click:
Exit Sub

Err_cmdProduction_Click:
MsgBox Err.Description
Resume Exit_cmdProduction_Click

End Sub

This is really doing my head in because I have done all of this countless
times before and it has always worked. I have even tried this on other
computers with only Access 2003 and I have tried other projects I have
built
in the past that worked and it all fails.

I know it's a lot that I have written, but I wanted to provide as much
detail as possible.

Cheers,

Stephen @ ZennHAUS

Hi,

Try to create new DB in Access 2003 and import all the objects from
your database. Then, switch to VBA (CTRL+G), add DAO reference if
needed (Tools\References), and run Debug\Compile. Looks like that
either one of the objects is damaged, db is damaged or Access 2007
have added one of the new properties which Access 2003 does not
recognize (Unknon property).

Regards,
Branislav Mihaljev
Microsoft Access MVP

Hi Branislav

Thanks for your advice. The DAO/debug didn't work unfortunately. I had
already tried creating a database in Access 2003 and copying everything
across, but when I did that Access 2003 created an Access 2000 format file
which I converted to a 2003 format after copying data. Also I brought all
the code across that time which I think was my downfall in that
circumstance. And, a final potential problem is that both versions are
running on the same machine so the possibility is that creating the new file
in 2003 on the same PC may have also been a contributor.

But, thanks to your advice and a VirtualPC with a clean copy of Access 2003,
I created a new database in 2000 format, converted it to 2003, then copied
all the data across without the forms and without the code modules, created
the forms again and hey presto it all works.

Thanks a million

Cheers

Stephen
 
B

banem2

Hi Guys and Gals
I have a database that was originally created in Access 2000, then
modified
in 2003 before I got it. I have since upgraded it to a 2003 format file
and
it has since been modified in both Access 2003 and 2007 depending on what
I
was doing.
All of the original objects have been deleted after migrating old datato
new tables to remove design flaws.
Finally, I am at the stage of creating forms. I created a couple of minor
forms in Access 2007 along with the main menu which is just a blank form
that I have added buttons to. The forms works fine in Access 2007, but
when
opened in Access 2003 on the same computer, Access 2003 fails and shuts
down. So, I deleted the forms from 2007 and recreated them in Access
2003.
It doesn't crash anymore, but I get the following error.
"Microsoft Office Access
The expression On Click you entered as the event property setting
produced
the following error: A problem occurred while Microsoft Office Access was
communicating with the OLE server or ActiveX Control.
*The expression may not result in the name of a macro, the name of a
user-defined function, or [Event Procedure].
*There may have been an error evaluation the function, event, or macro.."
It includes a Show Help >> button and an OK button.
The detail in the Show Help>> button says:
Visual Basic for Applications (VBA) encountered a problem while
attempting
to access a property or method. The problem may be one of the following:
* A reference is missing.
* For help restoring missing references, see the Microsoft Knowledge Base
article 283806.
* An Expression is misspelled.
* Check all expressions used in event properties for correct spelling.
* A user-defined function is declared as a sub or as a private function
in a
module.
* Expressions can resolve a user-defined function only if the functionis
declared as one of the following:
* A public function in a module
* A public or private function in a code module of the current form or
report
* Security in Access is set to Medium or High and the Microsoft Jet 4.0
SP8
update is not installed.
* A more recent version of Jet 4.0 must be installed for Access to
function
properly when security is set to Medium or High. To obtain the latest
version of Microsoft Jet, go to Windows Update.
I have already checked the references in the VBA project and they are as
follows:
* Visual Basic for Applications
* Microsoft Access 11.0 Object Library
* Microsoft DAO 3.6 Object Library
* Microsoft ActiveX Data Objects 2.1 Library
* OLE Automations
I have also changed the security to Low and made sure that Jet 4.0 is up
to
date. The code syntax matches that of reference guide and in fact the
code
was written by the Button control wizard.
The code is as follows:
Private Sub cmdProduction_Click()
On Error GoTo Err_cmdProduction_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmProduction"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdProduction_Click:
Exit Sub
Err_cmdProduction_Click:
MsgBox Err.Description
Resume Exit_cmdProduction_Click
End Sub
I also changed it to the following to simplify it in the hope that would
make a difference.
Private Sub cmdProduction_Click()
On Error GoTo Err_cmdProduction_Click
DoCmd.OpenForm "frmProduction"
Exit_cmdProduction_Click:
Exit Sub
Err_cmdProduction_Click:
MsgBox Err.Description
Resume Exit_cmdProduction_Click
End Sub
This is really doing my head in because I have done all of this countless
times before and it has always worked. I have even tried this on other
computers with only Access 2003 and I have tried other projects I have
built
in the past that worked and it all fails.
I know it's a lot that I have written, but I wanted to provide as much
detail as possible.
Cheers,
Stephen @ ZennHAUS

Try to create new DB in Access 2003 and import all the objects from
your database. Then, switch to VBA (CTRL+G), add DAO reference if
needed (Tools\References), and run Debug\Compile. Looks like that
either one of the objects is damaged, db is damaged or Access 2007
have added one of the new properties which Access 2003 does not
recognize (Unknon property).
Regards,
Branislav Mihaljev
Microsoft Access MVP

Hi Branislav

Thanks for your advice. The DAO/debug didn't work unfortunately. I had
already tried creating a database in Access 2003 and copying everything
across, but when I did that Access 2003 created an Access 2000 format file
which I converted to a 2003 format after copying data. Also I brought all
the code across that time which I think was my downfall in that
circumstance. And, a final potential problem is that both versions are
running on the same machine so the possibility is that creating the new file
in 2003 on the same PC may have also been a contributor.

But, thanks to your advice and a VirtualPC with a clean copy of Access 2003,
I created a new database in 2000 format, converted it to 2003, then copied
all the data across without the forms and without the code modules, created
the forms again and hey presto it all works.

Thanks a million

Cheers

Stephen

Hi Stephen,

There is no need to re-create forms when you are "downgrading" db from
Access 2007 to Access 2000 or 2003 format. There is an undocumented
command SaveAsText which you can use to save the form in text format.
Once when you do that in Access 2007, remove all the lines with
"Unknow Property" using Notepad and import the form in Access 2003
using LoadFromText (also undocumented command). Usage:

Application.SaveAsText acForm, "frmFormName", "c:\FormName.txt"
Application.LoadFromText acForm, "frmFormName", "c:\FormName.txt"

I got this advice from Access MVP Sascha Alexander Trowitzsch
(thanks!). Make sure you create backup copy and copy and copy of
database as in case if you remove something from txt which is required
you could damage db.

Regards,
Branislav Mihaljev
Microsoft Access MVP
 

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