Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2016
    Posts
    4

    Question Unanswered: Creating Preview and Print button for a list of reports in MS Access

    Hello everyone, I need help in creating a preview button and print button. I have a list of reports I created and I want each user to click on one report to either view or print. I have some code I created, but the problem with this code is when I click on the first report then the next report open and then so on without me clicking on it. I want users to choose which ever report they want to preview or print without each report opening at the same time.

    Private Sub cmdView_Click()
    DoCmd.OpenReport "rptCalibrationInhoueOutHouse", acViewPreview
    End Sub

    Private Sub cmdView_Click()
    DoCmd.OpenReport "rptCalRequired", acViewPreview
    End Sub

    Private Sub cmdView_Click()
    DoCmd.OpenReport "rptCalTimeInterval", acViewPreview
    End Sub

    Private Sub cmdView_Click()
    DoCmd.OpenReport "rptEquipStatus", acViewPreview
    End Sub

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    ?
    On yhe face of it you have the same code triggered by the same event 4 tines.
    Have a separate button and a separate puece of code for each report

    Or
    Use a checkbox or radio button asdiciated with each report then a button that opens the report. Eg
    A radio button group that has two values preview & print, could be a check box, your call... ckbxprint
    A radio button group for all required reports... rbreport
    A command button to take action... cmdAction

    User selects print or preview report
    User selects report.
    User presses action button
    Code in actionbuttons on click event works out what action is required on which report
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Quote Originally Posted by Danielle93 View Post
    ...when I click on the first report then the next report open and then so on without me clicking on it...
    Obviously something is very wrong, here, probably corruption! Multiple events all named cmdView_Click() should not run even one Report when clicked, much less four, but rather should pop an error: "Ambiguous name detected" and do nothing else!

    The first thing to attempt, for this type of thing, is to create a new, blank file and import everything into it. Only takes a minute or two to create and check out, and if it doesn't work you haven't really lost anything! And, amazingly, it does frequently work!

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

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
  •