Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2006

    Arrow Unanswered: Filtering Reports from combo

    hi . i am trying to call a report based on a combo box. say if 1 is clicked report 'A' should be called and if 2 is clicked on the combo box report B should be called.. i am just a novice with vb i tried this
    Private Sub CMDOK_Click()
    If [Forms]![Closed Transactions House Wise]![Combo6] = (FORMAT1) Then
    DoCmd.OpenReport "Closed Transactions House Wise", acViewPreview
    Else: DoCmd.OpenReport "Closed Transactions House Wise Format 2", acViewPreview
    End If

    End Sub
    but this only called the format 2 report

    any help would be highly appreciated

  2. #2
    Join Date
    Sep 2003
    blah blah blah ....

    if mycombobox.value & "" <> "" then
    Select Case MyCombobox.Value
    Case 1:
    DoCmd.OpenReport "The 1st Report"
    Case 2:
    DoCmd.OpenReport "The Next Report"
    Case 3:
    Case N:
    End Select

    This is a way ... There are any number of other ways to do this too ... Wait long enough and the other whiz-bangs around here will post other solutions ...
    Back to Access ... ADO is not the way to go for speed ...

  3. #3
    Join Date
    Apr 2004
    outside the rim
    If your combo box contains the corresponding report name on each row, you're a step ahead of the game. Do this by having a table that matches a report name to each item in your list and use a query to add that name.

    Let's say your list is numbers in column 1 and text in columns 2. Make a table with matching numbers and the corresponding report name in a second field.

    In a query, put your list together with the info in this new table and make this query the source of your combo.

    In the combo properties, add an extra column and make it's width 0 (so the user doesn't see it).

    In code, use the Column property to get the string in the new column (column numbering starts at 0, so the third column is number 2).

    There a few good examples of using this property in the help file.

    Do I qualify as a whiz-bang? In any case, this is just another of many ways to do it.


Posting Permissions

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