Results 1 to 6 of 6
  1. #1
    akshatagarwal93 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jul 2012
    Posts
    14

    Print button problems

    Hi,

    I have made a report ("Timings Report") which opens on the click of a button from a separate form ("Progress Form"). The report has a print button which opens the print dialog box for the user.

    The problem I am having is concerning the button on my form - when I click it, instead of opening the report, it just automatically prints the report. The code for click command on both is below...

    Private Sub cmdTimingsReport_Click()
    'Code runs when Progress Report command button is clicked



    DoCmd.OpenReport ("Timings Report")

    End Sub


    Private Sub cmdPrint_Click()
    'On pressing this button, the print dialog box opens

    DoCmd.RunCommand acCmdPrint

    End Sub


    Another problem I have been having with the code (which isn't as major) is on printing, the print command button still prints. I have tried using the cmdPrint.Visible = False statement but I just get an error: "You can't hide a control that has the focus."

    Thanks in advance
    AA93

  2. #2
    Compufreak is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jul 2012
    Posts
    70
    try this
    Private Sub cmdTimingsReport_Click()
    'Code runs when Progress Report command button is clicked

    DoCmd.OpenReport ("Timings Report") , acViewReport

    End Sub


    i am also new to access , but if that does not work then let me know

  3. #3
    akshatagarwal93 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jul 2012
    Posts
    14
    Yeah that's worked!
    Thanks... any idea about how to make the print command button invisible?

  4. #4
    Compufreak is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jul 2012
    Posts
    70
    try the following:
    cmdPrint.Enabled= False

    that should work, let me know again if it does

  5. #5
    Compufreak is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jul 2012
    Posts
    70
    did it work?

  6. #6
    akshatagarwal93 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jul 2012
    Posts
    14
    No that did not work... I got an error message: "You can't disable a control while it has the focus"

    I played around for a bit and found the cmdPrint.DisplayWhen property. Setting it equal to 2 hides the command button when printing ---> the help section seems to suggest it is specifically for printing!

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

Similar Threads

  1. Replies: 2
    Last Post: 04-02-2012, 04:34 AM
  2. Print Button
    By Meccer in forum Access
    Replies: 1
    Last Post: 03-15-2011, 07:31 AM
  3. Replies: 0
    Last Post: 02-22-2011, 05:04 AM
  4. Error in Print Report Button
    By Robert M in forum Reports
    Replies: 16
    Last Post: 09-23-2009, 03:08 PM
  5. add a print button
    By gromit95 in forum Forms
    Replies: 0
    Last Post: 08-13-2008, 07:28 AM

Tags for this Thread

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