• Print from list or combo (A2000)

    Author
    Topic
    #372453

    I have a combo populated with report names. I want to print the selected report from this combo.

    Does any one have any syntax that will help me.

    The rowsource for the combo is as follows

    SELECT [msysobjects].[Name] FROM msysobjects WHERE ((([msysobjects].[Type])=-32764));

    Dave

    Viewing 1 reply thread
    Author
    Replies
    • #595522

      You can use:

      DoCmd.OpenReport [cboReports], acViewPreview

      Replace cboReports with the name of your combo box.

    • #595529

      Hans
      Managed to sort it with the following:
      Just a small prob with the setfocus and dropdown.
      After update, the report prints and sets the focus back to the combo but doesn’t dropdown.
      Any Idea’s
      Dave

      Private Sub cmbPrinting_AfterUpdate()
      Dim stDocName As String
      stDocName = Me.cmbPrinting.Value
      DoCmd.OpenReport stDocName, acNormal
      Forms!mnuworkshopmanager.SetFocus
      Forms!mnuworkshopmanager!cmbPrinting.SetFocus
      Forms!mnuworkshopmanager!cmbPrinting.Dropdown
      End Sub

      • #595534

        I can’t help you with the dropdown, but I have some general remarks:

        • Using this code in cmbPrinting_AfterUpdate means that the report will be printed as soon as the user clicks an item. What if the user makes a mistake?
        • Since you want the list to be visible after the report prints, why not use a list box?
          [/list]With a list box, you can print in the OnDblClick event. That way, one wrong click doesn’t cause printing.
    Viewing 1 reply thread
    Reply To: Print from list or combo (A2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: