Access Data Form Doesn't Allow Printing All Records

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • JC2710
    New Member
    • Feb 2008
    • 39

    Access Data Form Doesn't Allow Printing All Records

    Hi

    I have a form in Access which is bound. I have a series of reports that are produced whoch the user can print.

    However when the user is on the data form if they click print, they print all records, each record as a screen print!

    Is there any way of stopping this?

    Thanks
  • Stewart Ross
    Recognized Expert Moderator Specialist
    • Feb 2008
    • 2545

    #2
    I suspect that when the command button for printing the report was placed on the form the wizard was used and Print Form was selected instead of Print (or Preview) Report. You will be able to tell for certain if you go to the code for the On Click event of the command button. If the code of the On click sub says something like this
    Code:
    DoCmd.SelectObject acForm, stDocName, True
    DoCmd.PrintOut
    DoCmd.SelectObject acForm, MyForm.Name, False
    replace it with
    Code:
    DoCmd.OpenReport stDocName, acPreview
    where stDocName is the name of your report. This will open the report in print preview mode (which then allows the user to select a printer to print the report and so on).

    -Stewart

    Comment

    • JC2710
      New Member
      • Feb 2008
      • 39

      #3
      Originally posted by Stewart Ross Inverness
      I suspect that when the command button for printing the report was placed on the form the wizard was used and Print Form was selected instead of Print (or Preview) Report. You will be able to tell for certain if you go to the code for the On Click event of the command button. If the code of the On click sub says something like this
      Code:
      DoCmd.SelectObject acForm, stDocName, True
      DoCmd.PrintOut
      DoCmd.SelectObject acForm, MyForm.Name, False
      replace it with
      Code:
      DoCmd.OpenReport stDocName, acPreview
      where stDocName is the name of your report. This will open the report in print preview mode (which then allows the user to select a printer to print the report and so on).

      -Stewart
      Hi Stewart

      Thanks for the reply but I dont think I explained myself very well!!

      The 'print' is the basic print command on the menubar. When the user is on a dataform if they click Select Print from the drop down menu it prints all records on the form as screenshots.

      I want the print option but only for printing reports. any way of stopping printing when the user is on a form?

      Thanks

      Comment

      • Stewart Ross
        Recognized Expert Moderator Specialist
        • Feb 2008
        • 2545

        #4
        Well, you could modify the menu to remove or disable the print command, or you could provide a custom menu for your users (a better option) but my own preference would be to add a command button to the main form which allows the users to print without selecting menu options to do so.

        -Stewart

        Comment

        • JC2710
          New Member
          • Feb 2008
          • 39

          #5
          Originally posted by Stewart Ross Inverness
          Well, you could modify the menu to remove or disable the print command, or you could provide a custom menu for your users (a better option) but my own preference would be to add a command button to the main form which allows the users to print without selecting menu options to do so.

          -Stewart
          Well i have got a custom menu but it has the print button on it!!

          I also have a command button on the form which previews a report but then I need a menu item to allow the user to print the report. If i code my own custom menu item eg

          docmd.Printout rptName

          it prints the whole report and doesnt bring up the print dialog screen. So therefore Im using the default print menu item provided by microsoft so I can display the print dialog screen. But this means the print menu item is available when just the main form is showing and therefore users can print all the records off as screenshots!!

          I just want a print menu item which only allows the user to print a report not a form.

          I hope this makes sense.

          Comment

          • JC2710
            New Member
            • Feb 2008
            • 39

            #6
            Originally posted by JC2710
            Well i have got a custom menu but it has the print button on it!!

            I also have a command button on the form which previews a report but then I need a menu item to allow the user to print the report. If i code my own custom menu item eg

            docmd.Printout rptName

            it prints the whole report and doesnt bring up the print dialog screen. So therefore Im using the default print menu item provided by microsoft so I can display the print dialog screen. But this means the print menu item is available when just the main form is showing and therefore users can print all the records off as screenshots!!

            I just want a print menu item which only allows the user to print a report not a form.

            I hope this makes sense.
            Hi Stewart

            I think Ive solved my problem. I have just disabled the menu which allows users to print and then enabled it when they load a report and then disable it again when they close the report. Seems to be working OK.

            Thanks for your help

            Comment

            Working...