Results 1 to 5 of 5
  1. #1
    blewis81 is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2019
    Posts
    23

    Custom macro has failed to run, and is preventing the report from rendering.

    I will preface by saying I know enough to be dangerous...cause problems. I am working in an existing database with VBA (far above my head) and other. I have been adding to this database as far as report/forms. While adding fields for a separate report I somehow changed something I shouldn't have which makes a preexisting report no longer able to render. I get a "run-time error 2427: you entered an expression that has no value" and when I click "end" I then get "A custom macro in this report has failed to run, and is preventing the report from rendering".



    When I selected "debug" It took me to a line of code that I don't see how it would be related. Any assistance is greatly appreciated. Able to send anything needed to asst

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    you don't normally run macros IN reports. You run the macros then open a report.
    you cant debug macros, tho they sometimes tell you the line that broke.

    can you provide the code?

  3. #3
    blewis81 is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2019
    Posts
    23
    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    If Me.TotalCount > 3 Then
    Cancel = 1
    End If

    End Sub

    Private Sub ReportFooter_Format(Cancel As Integer, FormatCount As Integer)
    If Me.TotalCount < 4 Then
    Cancel = 1
    End If
    End Sub


    Just copied and pasted where the "debug" took me. Highlighted "If Me.TotalCount >3 Then"
    I have a subform of procured items on an order "form". After 3 lines it is put in an excel spreadsheet because the report is laid over a Picture (PDFed form - someone else's). I had messed with the ExtendedPrice (quantity * unit cost) so don't understand why it points to the line above.

    I will add my query is no longer returning values.

  4. #4
    Bullschmidt's Avatar
    Bullschmidt is offline Freelance DB Developer
    Windows 10 Office 365
    Join Date
    Mar 2020
    Location
    USA
    Posts
    64
    Sometimes error messages can assume a bit and thus be a little misleading, so I would suggest...

    Make sure the TotalCount control (referred to in code) really still exists.

    Fix that query so that it shows some records as maybe the report doesn't actually work correctly if there are no records.

    Also I would suggest saving a copy of your database everyday (especially the last couple days) just in case you need to go back for something:
    MyProject-2020-03-16.accdb
    MyProject-2020-03-15.accdb
    MyProject-2020-03-14.accdb

  5. #5
    blewis81 is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2019
    Posts
    23
    The TotalCount seems to have done the trick. No longer getting the error. Posting new issue as separate thread. This one in particular has been solved.

    Thank you! YES, definitely saving copy when I figure something out/daily.
    Last edited by blewis81; 03-19-2020 at 10:09 AM.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Corrupted Record preventing macro-query to run
    By hammerman in forum Access
    Replies: 4
    Last Post: 12-14-2018, 02:29 PM
  2. Replies: 5
    Last Post: 03-20-2017, 02:15 PM
  3. Replies: 3
    Last Post: 03-08-2017, 05:42 PM
  4. Replies: 0
    Last Post: 12-13-2014, 07:18 AM
  5. Macro to save report to PDF with custom name
    By chris.williams in forum Programming
    Replies: 2
    Last Post: 10-13-2011, 02:34 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums