Results 1 to 2 of 2
  1. #1
    4 Star Lounger
    Join Date
    Mar 2005
    Leicestershire, United Kingdom
    Thanked 0 Times in 0 Posts

    Pass Parameters to Report From Menu (2000)

    I wish to open a report from the drop down menu bar. The report is based upon a query, which I want to sent it a condition so that report opens based on that condition. how is this achieved?
    Best Regards,


  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 28 Times in 28 Posts

    Re: Pass Parameters to Report From Menu (2000)

    One option is to create a parameter query: in the Criteria row for the relevant field, place a condition like this:

    [Please enter a value]

    You can modify the text, of course.

    Another option is to create a form with a text box to enter the value to filter on and a command button to open the report. The code for the command button would look like this:

    Private Sub cmdReport_Click()
    DoCmd.OpenReport "rptSomething", acViewPreview, "[FieldName]=" & Me.txtValue
    End Sub

    cmdReport is the name of the command button
    rptSomething is the name of the report
    FieldName is the name of the field to filter on
    txtValue is the name of the text box

    The above assumes that FieldName represents a numeric field; if it represents a text field, use

    ..., "[FieldName]=" & Chr(34) & Me.txtValue & Chr(34)

Posting Permissions

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