Results 1 to 3 of 3
  1. #1
    mistervelasco is offline Novice
    Windows XP Access 2007
    Join Date
    Oct 2009
    Posts
    2

    using a Form with combo boxes to generate reports

    I am trying to create a form which prints out a report based on the selection of two combo boxes.
    Combo Box 1.) Q1, Q2, Q3, Q4, YTD (dates)
    Combo Box 2.) RPT1, RPT2 RPT3 RPT4 (reports)

    I am first unable to get the reports to show in combo box 2. I found this code online but it includes all reports where I as I only need 4 particular reports.

    Private Sub Form_Open(Cancel As Integer)
    Dim Dbs As Database
    Dim Rpc As Container
    Dim Rpt As Document
    Set Dbs = CurrentDb
    Set Rpc = Dbs.Containers!Reports
    For Each Rpt In Rpc.Documents
    ReportList.RowSource = ReportList.RowSource & Rpt.Name & ";"
    Next
    ReportList.Requery
    Set Dbs = Nothing
    Set Rpc = Nothing


    Set Rpt = Nothing
    End Sub

    Next I am unsure how to go about setting up combo box 1. Should I create a query? How would I set that up?

    Each report is linked to a functional query. (There is no date parameters on the queries). I would like the user to be able to select whichever Report (combo box 2) and specificy for what date (combo box 1)

    In the past, I have created simple reports linked to queries which allow the user to enter a date range but only for that particular report.

    ANY and all help is greatly appreciated.

  2. #2
    mistervelasco is offline Novice
    Windows XP Access 2007
    Join Date
    Oct 2009
    Posts
    2

    Almost there.....

    So the form has and open and print button that now opens or prints reports from one of the combo boxes but I still need to populate the second combo box with "YTD", "Q1", "Q2", "Q3","Q4" and filter the reports according to those entries. I have played with the idea of using DatePart on the queries which are bound to the reports but there is a problem:

    1.) the quarters seem to be inccorect. I am using datepart and selecting the correct field but the quarters are not corresponding. For example, a date of 11/01/2008 returns "4" as in q4.

    Any how, Im thinking there may be another way to do this through the form, such as using code to specificy the quarters and populate the combo box but am unsure how to do this.

    Any help is greatly appreciated.

  3. #3
    dcrake's Avatar
    dcrake is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Aug 2009
    Posts
    435
    For a start you are allowing the user to select a quarter, say Q4 when Q4 is in the future (if the current quarter is Q2).

    In the reports underlying query if you include a field that calculates the quarter part of the date format([DateField],"q") Then you can apply your condition to this field. Having say that the quarter could be for any year so you need to think about this to.

    David

Please reply to this thread with any new information or opinions.

Similar Threads

  1. combo boxes
    By googenfrog in forum Forms
    Replies: 3
    Last Post: 07-03-2009, 05:41 PM
  2. Combo boxes on a form
    By Maranna in forum Forms
    Replies: 1
    Last Post: 06-22-2009, 01:48 PM
  3. combo boxes
    By labrams in forum Forms
    Replies: 0
    Last Post: 04-20-2006, 09:28 AM
  4. Replies: 1
    Last Post: 03-11-2006, 07:38 AM
  5. Combo Boxes
    By Mxcsquared in forum Forms
    Replies: 0
    Last Post: 01-19-2006, 04:59 PM

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
  •  
Other Forums: Microsoft Office Forums