Page 3 of 3 FirstFirst 123
Results 31 to 35 of 35
  1. #31
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,861
    No, you should have
    On Error GoTo Err_Handler ( or some suitably named label)



    Option Explicit makes sure you have declared ALL your variables.
    The number of times I have copied code from here and other sites, that would not even compile is beyond a joke.

    Only a very few times would you have On Error Resume Next, generally when you will expect an error.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  2. #32
    data808 is offline Noob
    Windows 10 Access 2013 32bit
    Join Date
    Aug 2012
    Posts
    727
    Quote Originally Posted by Gicu View Post
    Can you please show the record source for the fetch report? Does it have the criteria set to limit the records to only the one displayed in the fetch form?

    Cheers,
    Did a bit more testing just to see if something was wrong with the fetch form so I made a copy of the regular Counter Log and renamed it to Counter Log Fetch 2. Then set everything else up and ran it and the same result happened. Just keeps counting upwards for the pages when exporting to PDF.

    Next test I did was to try and open the Fetch form exactly the way the regular Counter Log opens. Only difference was the acFormEdit that I noticed:

    DoCmd.OpenForm "Counter Log", , , , acFormEdit

    So I applied that for the Fetch form to open that way. Still no change in the result.

    Last test I did was to see if multiple records were loading into the Fetch form. So I went into design view for the Fetch form and under the Format properties I turned on the record selectors and navigation buttons. I then put it through its user scenario of opening split form, clicking on reference number to bring up the record I want in the Fetch form and with the navigation buttons I was not able to look at any other record. It also said 1 of 1 for the record count. So at least we know that the Fetch form is loading with only one record. Which brings me back to the Fetch report. If the Fetch form is loading 1 record and the Fetch report pulls records from the Fetch form, shouldn't there only be 1 record that loads into the Fetch report?

    The only other thing I can think of is that my assumption to that prompt that shows the page count going upwards when trying to export to PDF is not in fact the amount of records it is trying to load but rather the document or form has a very large printing area and that is why it is taking up so many pages just to export to PDF?

    What do you think?

  3. #33
    data808 is offline Noob
    Windows 10 Access 2013 32bit
    Join Date
    Aug 2012
    Posts
    727
    Quote Originally Posted by Gicu View Post
    Can you please show the record source for the fetch report? Does it have the criteria set to limit the records to only the one displayed in the fetch form?

    Cheers,
    I think I found it problem. It works now. It was pulling up the regular Counter Log report instead of the Fetch report. The way I found out was making a copy of the backend file and deleting all records except for one. Then I ran it and of course the report exported to PDF with no problems. At that very moment I also noticed that the PDF that it created did not have the Fetch word in its title at the top. Which made me realize that it was creating a PDF from a report that did not have any filtering down to just one record. Once I made the correction, it worked. I'm going to test it some more but just wanted to let you know and thank you very much for all your help on everything.

  4. #34
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    Glad to hear that you got it working. Just to clarify, when you open a form with a Where clause in the Docks.aopenForm method the form actually opens filtered, but still has access to all records. So it is important to set up the report's record source to only include the current record.
    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  5. #35
    data808 is offline Noob
    Windows 10 Access 2013 32bit
    Join Date
    Aug 2012
    Posts
    727
    Quote Originally Posted by Gicu View Post
    Glad to hear that you got it working. Just to clarify, when you open a form with a Where clause in the Docks.aopenForm method the form actually opens filtered, but still has access to all records. So it is important to set up the report's record source to only include the current record.
    Cheers,
    Thanks for the explanation. Appreciate it! Take care.

Page 3 of 3 FirstFirst 123
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 04-09-2014, 09:42 AM
  2. Print / Save Button
    By data808 in forum Forms
    Replies: 10
    Last Post: 02-22-2014, 12:56 AM
  3. Replies: 4
    Last Post: 02-12-2014, 12:49 PM
  4. Replies: 5
    Last Post: 02-03-2014, 03:06 AM
  5. Print,save as and export option in report?
    By sunny in forum Reports
    Replies: 1
    Last Post: 07-27-2010, 09:55 AM

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