locked
action creating an Error 6 message on multiple machines RRS feed

  • Question

  • Hi,

    I have a save form as pdf button thanks to the help of some of the great people on here, it has worked fine for a while now but today has decided to bring up an Error 6: Overflow message when it is used, any ideas as to how I can fix this as I am demonstrating the database to my client on Thursday and want to make sure that everything works perfectly before then.

    I have tried the database on 3 seperate machines including a brand new laptop running windows 10 with the latest updates and it still brings up the same error code.

    Thank you in advance

    Richard

    Thursday, July 26, 2018 3:58 PM

All replies

  • Hi Richard,

    Can you post the offending code? Thanks.

    Thursday, July 26, 2018 4:03 PM
  • Hi .theDBguy,

    Here is the code including the error handler;

    Private Sub Command136_Click()
        On Error GoTo Error_Handler

        Dim stDocName As String

    Dim lngID As Long

    lngID = Me.CollectionReference

    Me.Filter = "CollectionReference=" & lngID
    Me.FilterOn = True

    DoCmd.OutputTo acOutputForm, Me.Name, acFormatPDF, , True

    Me.FilterOn = False

    Me.Recordset.FindFirst "CollectionReference=" & lngID

        LogEvent = "Form Saved as PDF: " & Me.Name
        User = Forms!LoginForm.txtUserName
       LogEvt


    PROC_EXIT:
      Exit Sub


    Error_Handler_Exit:
        On Error Resume Next
        Exit Sub

    Error_Handler:
        LogError Err.Number, Err.Description, "ProcName"
        Resume Error_Handler_Exit
    End Sub

    Kind Regards

    Richard

    Thursday, July 26, 2018 4:49 PM
  • Hi Richard,

    Thanks! No guarantees but let's try changing the following line from this:

    DoCmd.OutputTo acOutputForm, Me.Name, acFormatPDF, , True

    to this:

    DoCmd.OutputTo acOutputForm, Me.Name & ".pdf", acFormatPDF, , True

    Hope it helps...


    Thursday, July 26, 2018 5:28 PM
  • Hi,

    Unfortunately it didn't work, any other ideas?

    Kind Regards

    Richard

    Thursday, July 26, 2018 6:12 PM
  • Hi Richard,

    "didn't work" could mean anything. Did you get the same error or something else or nothing happened?

    Anyway, I think I misplaced where I put was I was thinking. I think it should have been more like this:

    DoCmd.OutputTo acOutputForm, Me.Name, acFormatPDF, CurrentProject.Path & "\" & Me.Name & ".pdf", True

    Hope it helps...

    Thursday, July 26, 2018 6:27 PM
  • Hi .theDBguy,

    The Error 6 message was still showing with both the first amendment and the second amendment.

    Kind Regards

    Richard

    Friday, July 27, 2018 8:10 PM
  • Hi Richard,

    Is there any way you can share a copy of your db for examination?

    Just curious...

    Friday, July 27, 2018 8:14 PM
  • Hi,

    How would I go about sharing it with you, I wouldn't be comfortable sharing it publicly?

    Just a heads up, it is quiet large and probably a coding mess as I am still learning.

    Kind Regards

    Richard

    Sunday, July 29, 2018 12:44 PM
  • What version are you using? My version 2007 doesn't even recognize Me.CollectionReference as a valid form reference and data member. I get a compile error when I test run your code. Did you actually step through your code to isolate the line that is causing the error? Is CollectionReference something new in later versions?
    Sunday, July 29, 2018 2:45 PM
  • Hi,

    I am using office 365 version.

    ColectionReference isn't the issue from what I can tell, when stepping through it immediately goes to the error handler, the frustrating thing is that it used to work but now doesn't work.

    Kind Regards

    Richard


    • Edited by R.Nock Sunday, July 29, 2018 5:07 PM
    Sunday, July 29, 2018 5:05 PM
  • Well when you step through it, which line is causing the error? Also, does your code compile without error? I doubt it really was working. You may have thought it was because the error handler has a Resume statment. Comment out the  On Error GoTo Error_Handler line and then compile the code and step through it without the error handler being active. That will pinpoint which line is casuing the error and perhaps give you some information as to what is happening.
    Sunday, July 29, 2018 7:26 PM
  • Hi,

    On step through it goes to;

    lngID = Me.CollectionReference

    then jumps to the error handler.

    It definately used to work as it brought up the save as option and I could open the pdf documents (one for each form that was saved).

    Kind Regards

    Richard

    Monday, July 30, 2018 11:25 AM
  • As I said before, Me.CollectionReference is not a valid form object reference in ACCESS. I don't know where you got that, but you thought it was working because the code routine Resumes each time it encounters an error.

    By the way, Me.Recordset.FindFirst is also an invalid command because the FindFirst command only works if you have defined and opened a recordset first, which you have not.

    The DoCmd.OutputTo acOutputForm, Me.Name, acFormatPDF, , True command does work however. You need to refine your form filtering criteria so it does not include CollectionReference. ACCESS does not know what that refers to, thus the error.

    Monday, July 30, 2018 1:23 PM
  • Hi,

    We can agree to disagree on whether or not this used to work, the fact is that it isnt working now.

    I take on board what you are saying in relation to the filter, do you have any suggestions regarding a solution?

    Kind Regards

    Richard

    Monday, July 30, 2018 1:59 PM
  • I can't advise you on the forms filter because I don't know what your filtering criteria should be. That is up to you. For sure, you can't use:

    Me.Filter = "CollectionReference=" & lngID

    because Me.Filter = "CollectionReference=" & lngID is nonsense to ACCESS.

    I would study how to filter a form according to what your form displays, then use the Me.Filter command to filter it. Once you have the filtering criteria working, you use the DoCmd.OutputTo acOutputForm, Me.Name, acFormatPDF, , True command.

    Monday, July 30, 2018 2:49 PM