report header onprint event procedure does not fire

E

EVPLS

Hi,

in the report header onprint event, my report calls a sub that is to write
table-of-contents data into a table (as per MS Knowledge Base article).
However, the event would not fire.

I tried compress and repair, copied the whole database into a new one,
decompiled and recompiled, still the event would not fire.

From the Properties panel, I can get smack into the report header onprint
event procedure so I guess you could rule out a typo.

Funny thing is: in other reports it works. Appreciate your ideas, thanks in
advance.
 
A

Allen Browne

What version of Access is this?
And what report view are you using?

If you use Access 2007, the section events don't fire in Report view or
Layout view. They do fire in Preview or Normal (i.e. when printed), unless
it's a security issue (e.g. you need to trust the folder where your database
lives.)
 
E

EVPLS

Allen,

thanks for your quick response from "down under".

I'm using A2003 in A2000 format (for compatibility reasons with A2000
installations the database is to run on).

I tried both preview and normal. As for a possible security issue: The
database lives on my harddisk (C:\) in a subfolder of the MyDocuments folder
(so I guess I'd better have full privileges on that one -- in Windows
Explorer I do).

Come to think of it: The problem arises with a few reports containing one
unbound OLE object each (MS Word documents); linked, not embedded,
autoupdate. The doc files live in a subfolder of the backend path on the
server of which (the path) I am the owner (again, full priviliges in Windows
Explorer). The OLE objects update alright when I open the reports in Preview
or Normal.

In reports not containing OLE objects, the event fires properly and builds
the TOC table.

Thanks for your assistance.
 
E

EVPLS

Hi Allen,

nothing marked as missing. Got VBA, Access 11 and DAO 3.60 object libraries
checked and present. Code compiles with no error messages.

Before I sent my original mail, I had followed your recovery sequence as
outlined in allenbrowne.com/recovery.html and, after that hadn't helped,
started a whole new database importing everything from tables to modules.

Let's not spend too many grey cells on this. I put the call of the TOC
routine into the reprot header onformat procedure and it does the job there.
I had put the routine into the OnPrint procedure only because Microsoft in
their KB said so and as naive as I were I followed their advice.

Thank you very much for your efforts so far.
 
A

Allen Browne

That's strange. The events should fire (assuming there are some records.)

I assume you have added a line like this as the *first* one in the
procedure:
Debug.Print "Detail_Print event ran at " & Now()
to verify if the event is firing.
 
E

EVPLS

Hi Allen,

strange as it may be, it seems to work in OnFormat. No, I had no code
written to check the time the OnPrint event fired, I had a breakpoint (I mean
that F9 thing just in case breakpoint weren't the correct English term, I
work with a German-language version) set at the start of the procedure. When
running the report, processing never stopped at that breakpoint which, as I
presume, it should have.
 

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