Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2008
    Posts
    25

    Unanswered: report based on date range and additional field

    Hi all,

    I have used a sample DB to produce a form where you can select a date range to produce a report. It is working fairly well, however, when I select the dates and click "Open Report", I am prompted to Enter Parameter Value for Part Number and Production Date, which is coming from some extra code in the original sample I used.

    I've attached the DB, and if anyone could take a look to tell me how to eliminate that step it would be greatly appreciated. I am new to reports and VBA script!

    As well, I would like to include an additional step where the user can produce a report based on the date range AND another field such as SpeciesName or Location.

    Is there a simple way to accomplish this?

    thanks!
    Attached Files Attached Files

  2. #2
    Join Date
    Sep 2008
    Location
    Amherst NY (near Buffalo)
    Posts
    11
    gbuckton, I don't have time to take a look at your database right now, but this extra parameter is usually caused by a MISSPELLED field name in your query or report, or even a parameter value in a criteria field somewhere that you missed.

    You can use VBA code to build a WHERE condition as complex as you'd like. For example:

    Dim MyWhere as String
    MyWhere = "BeginDate < #" & SomeDate & "# AND EndDate > #" & SomeDate & "# AND SpeciesName='" & SomeName & "'"
    DoCmd.OpenReport "ReportName",,MyWhere

    Now just throw that into your button. Piece of cake. You can even make those fields (SomeDate, SomeName, etc.) text boxes on your form.

    I cover all of this in my advanced Access tutorials.

    Hope this helps.

Posting Permissions

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