Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2009

    Unanswered: Opening a Report based on two Criteria from a Form


    I have what should be a simple problem to fix but i cannot find the solution anywhere. I have a form that is used to release a list of production orders. On the form I have two critical peices of criteria that i need to use to open a report with focus. The feild names and data types are as follows:

    DateRlsd - Date/time
    PrimDept - Text

    I am running the report from a query and under each of the columns for the two feilds above I have the following criteria specified:



    The code that i have to run the report is as follows. The code is set to enter the DateRlsd based on an unbound text box I have where you type the date. It loops through all teh records displayed on the form and then prints the report. The problem is that the report is blank.

    Private Sub cmdAddDate_Click()

    On Error GoTo Err_End

    If IsDate(rlsedate) Then

    DoCmd.GoToRecord , , acFirst

    Me.[DateRlsd] = [rlsedate]



    DoCmd.GoToRecord , , acNext

    Me.[DateRlsd] = [rlsedate]


    GoTo Next_Record


    MsgBox "Require a date in the date box"

    End If

    Exit Sub


    Me.Dirty = False

    DoCmd.OpenReport "rptJournal", acViewNormal

    End Sub

  2. #2
    Join Date
    Apr 2005
    Zagreb - Croatia
    Look at "DemoReport2CriteriaA20022003.mdb (attachment, zip).
    Look at Table1, Form1 (VBA), Query1, Report1.
    Open form and try. Adapt it in your mdb.
    Put LIMIT TO LIST = YES (properties on first combo).
    Attached Files Attached Files

  3. #3
    Join Date
    Aug 2009
    Thanks for the reply MStef-ZG but unfortunately I don't think this covers what I needs to do. The error checking I have in the code actually works, I just need to open the report displaying all the records that are displayed on my form. Does it have to do with my where condition in the open command?

  4. #4
    weejas is offline Grumpy old man (training)
    Join Date
    Sep 2006
    Surrey, UK
    Provided Answers: 18
    You need to add the fourth argument to the OpenReport command - the where argument. See the help file for more on this.
    10% of magic is knowing something that no-one else does. The rest is misdirection.
    Beers earned: 2

Posting Permissions

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