Event error - pls help.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Dear friends,

I am confronting with an error and I do not know why it appears and how I
can get rid of it.

The error comes when I write a code in ANY of the event methods of the
report - On Activate, On Open etc.

The error message is: "The expression On Activate you entered as the event
property setting produced the following error: A problem occured while Access
was communicating with the OLE server or Activex control"

On Activate is replaced with On Open if I use this event. Now even if I
delete the code, the error still persists and I cannot get rid of it unless I
replace the report with the one from my safety copy. And the story repeats
again.

The code I am inserting is "docmd.maximized". Thats all. Immediately after
that I get some other errors inside report - "Name?" - for some controls
which contains the following kind of expressions : =Iif(test=0,
"profile","operations")


Thanks in advance for your support.

Catalin
 
Give us an exzample of the VBA code (entire procedure) that you're using as
the event procedure's programming. You are not putting "DoCmd.Maximize"
directly in the box next to "On Activate" on the Event tab in the Properties
popup window, are you?
 
Yes I do.
I put only "DoCmd.Maximize".

Catalin

Ken Snell (MVP) said:
Give us an exzample of the VBA code (entire procedure) that you're using as
the event procedure's programming. You are not putting "DoCmd.Maximize"
directly in the box next to "On Activate" on the Event tab in the Properties
popup window, are you?
 
That is not the way to do it.

In that box, select "[Event Procedure]" from the dropdown box. Then click on
the three-dot button at far right of the box -- this will open the Visual
Basic Editor (VBE), and you'll see that the cursor is on a blank line
between a code line above it (Private Sub xxxxx) and a code line below it
(End Sub). Type the DoCmd.Maximize in that blank line. Close the VBE. Save
the form. Close the form. Open the form in normal view; it should work for
you now.
 
Dear Ken,

I am sorry that I misslead you. I didn't carefuly read your reply. When I
said that I wrote only "docmd.maximize" I meant inside the "private"
procedure within VBE.

So, I have respected all the rules concernng events and still the error
persists.

What can be wrong?

Catalin

Ken Snell (MVP) said:
That is not the way to do it.

In that box, select "[Event Procedure]" from the dropdown box. Then click on
the three-dot button at far right of the box -- this will open the Visual
Basic Editor (VBE), and you'll see that the cursor is on a blank line
between a code line above it (Private Sub xxxxx) and a code line below it
(End Sub). Type the DoCmd.Maximize in that blank line. Close the VBE. Save
the form. Close the form. Open the form in normal view; it should work for
you now.

--

Ken Snell
<MS ACCESS MVP>



Catalin said:
Yes I do.
I put only "DoCmd.Maximize".

Catalin
 
By the combination of the problems that you describe, it appears that the
report is becoming corrupted somehow when you try to use it. The fact that
your textboxes start to show "#Name?" errors indicates that the report has
"lost" its recordsource, or the textbox with the expression in it has the
same name as a field in the recordsource.

What is the name of the textbox with the IIf expression (that you posted) as
the control source?
--

Ken Snell
<MS ACCESS MVP>




Catalin said:
Dear Ken,

I am sorry that I misslead you. I didn't carefuly read your reply. When I
said that I wrote only "docmd.maximize" I meant inside the "private"
procedure within VBE.

So, I have respected all the rules concernng events and still the error
persists.

What can be wrong?

Catalin

Ken Snell (MVP) said:
That is not the way to do it.

In that box, select "[Event Procedure]" from the dropdown box. Then click
on
the three-dot button at far right of the box -- this will open the Visual
Basic Editor (VBE), and you'll see that the cursor is on a blank line
between a code line above it (Private Sub xxxxx) and a code line below it
(End Sub). Type the DoCmd.Maximize in that blank line. Close the VBE.
Save
the form. Close the form. Open the form in normal view; it should work
for
you now.

--

Ken Snell
<MS ACCESS MVP>



Catalin said:
Yes I do.
I put only "DoCmd.Maximize".

Catalin

:

Give us an exzample of the VBA code (entire procedure) that you're
using
as
the event procedure's programming. You are not putting
"DoCmd.Maximize"
directly in the box next to "On Activate" on the Event tab in the
Properties
popup window, are you?

--

Ken Snell
<MS ACCESS MVP>


Dear friends,

I am confronting with an error and I do not know why it appears and
how
I
can get rid of it.

The error comes when I write a code in ANY of the event methods of
the
report - On Activate, On Open etc.

The error message is: "The expression On Activate you entered as the
event
property setting produced the following error: A problem occured
while
Access
was communicating with the OLE server or Activex control"

On Activate is replaced with On Open if I use this event. Now even
if I
delete the code, the error still persists and I cannot get rid of it
unless I
replace the report with the one from my safety copy. And the story
repeats
again.

The code I am inserting is "docmd.maximized". Thats all. Immediately
after
that I get some other errors inside report - "Name?" - for some
controls
which contains the following kind of expressions : =Iif(test=0,
"profile","operations")


Thanks in advance for your support.

Catalin
 
Hi,

The name of the textbox which contains the Iif expression is Text32 and has nothing to do with the field names or any other control name in the report.

I have tried many things since last week and I can tell you in what conditions I get the error.
First, if I use just the name of the field inside the controlsource property I get no error and everything is fine just like the other controls in the report. But when I try to write an expression (even simple one like "=test" where test is a field name) I receive the error "#Name?". The expression is automatically changed to "=[test]" and the error occurs.

I tried to write some simple code in VB in "On Print" event and I receive the error that I have mentioned in my first post regarding the communication with OLE server a.s.o.

I think that by changing the name with the square brackets triggers the error.

This is very awkward because I use a lot of these kind of expressions in my reports and this is actually the first time when I face this problem. By replacing the report with the one (identical report !!) saved in the back-up file cleares the problem which is also strange.

Any ideas?

Thanks for your help.

Catalin
 
Back
Top