Results 1 to 5 of 5
  1. #1
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Print from list or combo (A2000)

    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

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Print from list or combo (A2000)

    You can use:

    DoCmd.OpenReport [cboReports], acViewPreview

    Replace cboReports with the name of your combo box.

  3. #3
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Print from list or combo (A2000)

    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

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Print from list or combo (A2000)

    I can't help you with the dropdown, but I have some general remarks:
    <UL><LI>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?
    <LI>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.

  5. #5
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Print from list or combo (A2000)

    Cheers Hans.
    I'll mess about with it a bit

    Dave

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •