OnClick[event procedure] causes error

G

Guest

Good Morning.

I am creating a new form which has never worked. I open a form that has
several command buttons. One of the buttons has a OnClick[event procedure]
which causes an error when pressed. Another of the command buttons executes
a macro which opens a second form. Form2 also has command buttons. One of
the buttons on form2 has a OnClick[event procedure] which works as expected
sending me to my VB procedure.

I have tried several OnEvent buttons (OnClick, OnGotFocus, OnEnter, etc.) on
Form1 and all give the same error message. The procedures were only one line
of code to eliminate "bad code" causes.

The primary error message is: “The expression On Click you entered as the
event property setting produced the following error: A problem occurred while
Microsoft Office Access was communication with the OLE server or ActiveX
control.â€

I am using MS 2007 to create an .mdb database. I tested the DB on a copy of
MS 2003 and got the same result.

Any help would greatly be appreciated!
 
G

Guest

I believe you have put the code in the properties instead of actually in the
VBA IDE (Integrated Development Environment) window. You need to, in the
Click event property for the form make sure [Event Procedure] is listed and
then click the elipsis (...) to the right of it and open the code window.
Put the code in there.
--


Bob Larson
HTH
:)
____________________________________
Access 2000, 2003, 2007, SQL Server 2000, Crystal Reports 10/XI, VB6
WinXP, and Vista
 
G

Guest

Thank you for your reply. I originallly created the entry (see below) using
just your method.

Private Sub cmdExitSave_Click()

End Sub
Where should I look next?

boblarson said:
I believe you have put the code in the properties instead of actually in the
VBA IDE (Integrated Development Environment) window. You need to, in the
Click event property for the form make sure [Event Procedure] is listed and
then click the elipsis (...) to the right of it and open the code window.
Put the code in there.
--


Bob Larson
HTH
:)
____________________________________
Access 2000, 2003, 2007, SQL Server 2000, Crystal Reports 10/XI, VB6
WinXP, and Vista


Dave said:
Good Morning.

I am creating a new form which has never worked. I open a form that has
several command buttons. One of the buttons has a OnClick[event procedure]
which causes an error when pressed. Another of the command buttons executes
a macro which opens a second form. Form2 also has command buttons. One of
the buttons on form2 has a OnClick[event procedure] which works as expected
sending me to my VB procedure.

I have tried several OnEvent buttons (OnClick, OnGotFocus, OnEnter, etc.) on
Form1 and all give the same error message. The procedures were only one line
of code to eliminate "bad code" causes.

The primary error message is: “The expression On Click you entered as the
event property setting produced the following error: A problem occurred while
Microsoft Office Access was communication with the OLE server or ActiveX
control.â€

I am using MS 2007 to create an .mdb database. I tested the DB on a copy of
MS 2003 and got the same result.

Any help would greatly be appreciated!
 
G

Guest

The code you posted is blank inside. Was that always like that, or did you
just post that piece? Also, you need to make sure that the control wasn't
renamed after the code was added.

Other than that, you can email the db to me at accessbob at gmail dot com
and I can try to figure it out.

--
Bob Larson
Access World Forums Super Moderator
Utter Access VIP
____________________________________
Access 2000, 2003, 2007, SQL Server 2000, Crystal Reports 10/XI, VB6
WinXP, Vista


Dave said:
Thank you for your reply. I originallly created the entry (see below) using
just your method.

Private Sub cmdExitSave_Click()

End Sub
Where should I look next?

boblarson said:
I believe you have put the code in the properties instead of actually in the
VBA IDE (Integrated Development Environment) window. You need to, in the
Click event property for the form make sure [Event Procedure] is listed and
then click the elipsis (...) to the right of it and open the code window.
Put the code in there.
--


Bob Larson
HTH
:)
____________________________________
Access 2000, 2003, 2007, SQL Server 2000, Crystal Reports 10/XI, VB6
WinXP, and Vista


Dave said:
Good Morning.

I am creating a new form which has never worked. I open a form that has
several command buttons. One of the buttons has a OnClick[event procedure]
which causes an error when pressed. Another of the command buttons executes
a macro which opens a second form. Form2 also has command buttons. One of
the buttons on form2 has a OnClick[event procedure] which works as expected
sending me to my VB procedure.

I have tried several OnEvent buttons (OnClick, OnGotFocus, OnEnter, etc.) on
Form1 and all give the same error message. The procedures were only one line
of code to eliminate "bad code" causes.

The primary error message is: “The expression On Click you entered as the
event property setting produced the following error: A problem occurred while
Microsoft Office Access was communication with the OLE server or ActiveX
control.â€

I am using MS 2007 to create an .mdb database. I tested the DB on a copy of
MS 2003 and got the same result.

Any help would greatly be appreciated!
 
G

Guest

I did a cut-and-paste to show what I did. The inside contained a single line
of code to eliminate coding errors. I used a global variable like
"gvarA=gvarA" inside. I also established a break point on the line of code
to stop it there all to no avail. Control was never passed to the
subroutine. Let me clean up my db and send you a copy.

boblarson said:
The code you posted is blank inside. Was that always like that, or did you
just post that piece? Also, you need to make sure that the control wasn't
renamed after the code was added.

Other than that, you can email the db to me at accessbob at gmail dot com
and I can try to figure it out.

--
Bob Larson
Access World Forums Super Moderator
Utter Access VIP
____________________________________
Access 2000, 2003, 2007, SQL Server 2000, Crystal Reports 10/XI, VB6
WinXP, Vista


Dave said:
Thank you for your reply. I originallly created the entry (see below) using
just your method.

Private Sub cmdExitSave_Click()

End Sub
Where should I look next?

boblarson said:
I believe you have put the code in the properties instead of actually in the
VBA IDE (Integrated Development Environment) window. You need to, in the
Click event property for the form make sure [Event Procedure] is listed and
then click the elipsis (...) to the right of it and open the code window.
Put the code in there.
--


Bob Larson
HTH
:)
____________________________________
Access 2000, 2003, 2007, SQL Server 2000, Crystal Reports 10/XI, VB6
WinXP, and Vista


:

Good Morning.

I am creating a new form which has never worked. I open a form that has
several command buttons. One of the buttons has a OnClick[event procedure]
which causes an error when pressed. Another of the command buttons executes
a macro which opens a second form. Form2 also has command buttons. One of
the buttons on form2 has a OnClick[event procedure] which works as expected
sending me to my VB procedure.

I have tried several OnEvent buttons (OnClick, OnGotFocus, OnEnter, etc.) on
Form1 and all give the same error message. The procedures were only one line
of code to eliminate "bad code" causes.

The primary error message is: “The expression On Click you entered as the
event property setting produced the following error: A problem occurred while
Microsoft Office Access was communication with the OLE server or ActiveX
control.â€

I am using MS 2007 to create an .mdb database. I tested the DB on a copy of
MS 2003 and got the same result.

Any help would greatly be appreciated!
 

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