Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2004

    Unanswered: report won't run

    Hello all,
    I have a form that has a unbound field based on a query. Next to it, I have a command button to preview a report based on the selection of the unbound field. For example, a user selects a location from the drop down list. They click the preview button but it's returns a blank report. I have the exact same code on the same form to view a name selected the same way and it works perfectly. Can someone tell be why it doesn't work for location but works for name? Here's my code for both the location and name:

    doesn't work

    Private Sub CmdPreviewBranch_Click()
    On Error GoTo err_CmdPreviewBranch
        Dim rptdocname As String
        rptdocname = "rptOccur_Branch"
        DoCmd.OpenReport rptdocname, acViewPreview
        Exit Sub
        MsgBox Err.Description
        Resume Exit_cmdPreviewBranch_Click
    End Sub

    Private Sub cmdPreview_Click()
    On Error GoTo Err_cmdPreview_Click
        Dim rptdocname As String
        rptdocname = "rptOccur_Member"
        DoCmd.OpenReport rptdocname, acPreview
        Exit Sub
        MsgBox Err.Description
        Resume Exit_cmdPreview_Click
    End Sub
    Both reports are based on a query with a criteria to point to the unbound field: [forms]![frmreportbuilder]![Combo8]

  2. #2
    Join Date
    May 2004
    New York State
    Step 1. With the form closed, run each report's query separately. When you're prompted to "Enter [forms]![frmreportbuilder]![Combo8]", enter a value you know should be correct. If a report is empty, your problem is in the query... or table.

    Step 2. If both reports work correctly, rerun the reports using the form. When it doesn't work, make sure the value you're feeding the report from Combo8 is what you think it is.


Posting Permissions

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