Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2012
    Posts
    126

    Unanswered: VBA for a button to open a report listed in a list box

    Sorry for the confusing title. I have a list box that looks at mysysobjects name and type = -32764 to show me a list of reports in my DB. I want the user to be able to select one and then click a button to print them. I tried using me.report as my code but that doesn't work (and i understand why). Im sure this is easier than Im making it out to be. Anyone able to help me out?

  2. #2
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Code:
    If Nz(Me.lstReportToPrint,"") <> "" Then
       DoCmd.OpenReport lstReportToPrint, acNormal
    Else
       MsgBox ("You Must First Select a Report To Print!")
       Me.lstReportToPrint.SetFocus
    End If
    
       Me.lstReportToPrint = Null

    Replace lstReportToPrint with the actual name of your Listbox.

    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

  3. #3
    Join Date
    Aug 2012
    Posts
    126
    AMAZING! thank you. This is definitely the new way im doing report lists.

  4. #4
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Glad we could help!

    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

Posting Permissions

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