Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 19th, 2007, 12:11 PM
Friend of Wrox
 
Join Date: Jun 2005
Posts: 181
Thanks: 0
Thanked 0 Times in 0 Posts
Default Reports Issue

Hi All and a Merry Christmas
I am using the following code to run a report. Is there anyway that this code could prompt for a report selection rather than just one report

    Dim stDocName As String

    stDocName = "FrmReports"



    If Len(Me.txtdatefrom & vbNullString) = 0 Or Len(Me.txtDateTo & vbNullString) = 0 Then
        MsgBox "Please ensure that a report date range is entered into the form", _
               vbInformation, "Required Data..."
        Exit Sub
    Else
        DoCmd.OpenReport stDocName, acPreview
Thanks


Brendan Bartley
__________________
Brendan Bartley
 
Old December 19th, 2007, 10:26 PM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 217
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Brendan,
You can build a dialog form where the user chooses which report they want to open. (Such as using radio buttons).
Example:
1. OPtion 1 could be "View Client Report" (if selected the rptClient (Client Report) opens) Option 2: "View Inventory Report" (which opens (rptInventory)the Inventory Report.)
2. Use a Select Case statement to determine which the user has chosen and determine which report to open.
    (ie:
          Dim stDocName As String
          Select Case fraReports
                case 1 '(option 1) user wants Client Report (rptClient)
                       stDocName = "rptClient"
                case 2 'option 2 user wants Inventory Report (rptInventory)
                       stDocName = "rptInventory"
                'other cases
           End SElect

     DoCmd.OpenReport stDocName, acPreview

BTW- Why are you prompting the user for the date range for the report? Are you using that info for filtering? (Is its use just not included in this snippet?

HTH,

Loralee








Similar Threads
Thread Thread Starter Forum Replies Last Post
Crystal Reports - Print on back of page issue ralphred Crystal Reports 2 January 30th, 2015 03:15 AM
.NET C# Crystal Reports 9.0 Report browsing issue vhrao C# 0 April 23rd, 2007 09:06 AM
how to get reports in crystal reports using ASP3.0 candy133 Classic ASP Basics 2 January 26th, 2006 08:26 AM
comparision among crystal reports and Data reports avats Crystal Reports 0 April 13th, 2005 01:01 PM
How to create/design reports with crystal reports BassmaniaQ Crystal Reports 0 December 14th, 2004 04:58 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.