Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Mar 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Access Report not calling all Event vba procedures, what's up with that?

    I have two databases, Access 2010. In one, all the vba procedures written for the events in the report are executing correctly. In the other, only Report_Open and Report_Close are executing. Detail_Format, Detail_Print, PageHeaderSection_Format, ReportHeader_Format are not executing. I have not changed the default names of the parts of the report, so the sub names are correct.

    I know they are not executing because I have put debug.print statements in each, as well as MsgBox statements (might as well get told in two places, eh?). In fact, I have reduced these methods to merely the MsgBox and debug.print statements, and none is executed.

    Sample:
    Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As Integer)
    MsgBox ("ReportHeader_Format")
    Debug.Print "ReportHeader_Format"
    End Sub

    When I step through the code, starting in Report_Open, it just finishes Report_Open and displays the report.

    Can anyone give me a clue where to look for the problem?

    Thanks

  2. #2
    4 Star Lounger SteveH's Avatar
    Join Date
    Jan 2001
    Location
    Chelsea, Gtr London, United Kingdom
    Posts
    587
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Are you opening the reports in Report Preview as opposed to Print Preview? VBA code does not run in Report Preview.
    Steve H
    IT Lecturer/Access Developer
    O2K SR3/O2010; Win7Pro

  3. #3
    New Lounger
    Join Date
    Mar 2013
    Posts
    16
    Thanks
    0
    Thanked 1 Time in 1 Post
    You are undoubtedly opening your report in a screen-oriented Report View or Layout View, rather than the long-time standard Print Preview. Format events fire only when Access is preparing send output to a printer. If Report View or Layout View is important to you, move or copy your code to corresponding Paint events. Paint events fire as you page through a report on the screen, whether in Report View or Layout View.
    Last edited by James Pilcher; 2013-03-12 at 17:12.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •