Results 1 to 6 of 6
  1. #1
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Need Proper Code? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    I have a Report with a Subreport in the Detail Section

    The Subreport Record Source is driven by a query with the following start and end date criteria:

    <pre>(>=[Enter Start Date: Example m/d/y, or OK for All]
    Or Like [Enter Start Date: Example m/d/y, or OK for All] & "*")
    And (<=[Enter End Date: Example m/d/y, or OK for All]
    Or Like [Enter End Date: Example m/d/y, or OK for All] & "*")
    </pre>


    In my Report Page Header in have text control (DateRange) with the following in the Control Source:

    <pre>="Trans from" & [Enter Start Date: Example m/d/y, or OK for Alll] & " to "
    & [Enter Start End: Example m/d/y, or OK for Alll]
    </pre>


    Everything works fine except I

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Need Proper Code? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    In the report header you write all with 3 l : OK for Alll]
    Is this the problem ?
    Francois

  3. #3
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Need Proper Code? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    Good observation

    I changed it to the following with no success, same error.

    <pre>="Trans from" & [Enter Start Date: Example m/d/y, or OK for All] & " to "
    & [Enter Start End: Example m/d/y, or OK for All]
    </pre>


    I have used this technique before, the only difference was the Record Source was in the Report Section, not the Subreport Detail Section.

    Any thoughts?

    John

  4. #4
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Need Proper Code? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    I don't know if you can refer to a parameter from the subreport (query) in the main report.
    I would create a little form where you ask the start en end date and refer to the two textboxes in the subreport (query) and in the header of the main report.
    Francois

  5. #5
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Need Proper Code? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    I got it to work as follows:

    I moved the following to the Subreport Footer:
    <pre>Me.StartDate = [Enter Start Date: Example m/d/y, or OK for All]
    Me.EndDate =[Enter End Date: Example m/d/y, or OK for All]
    </pre>


    I put this in Subreport:
    <pre>Private Sub Report_Open(Cancel As Integer)
    gloSetValue "StartDate", Me.StartDate
    gloSetValue "EndDate", Me.EndDate
    End Sub
    </pre>


    And put this in Report:
    <pre>Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As Integer)

    'print report for the month
    Me.DateReported = "Month of: " & Format(gloGetValue("StartDate"), "mmmm")
    Me.DateReported = Me.DateReported & " Year: " & _
    Format(gloGetValue("StartDate"), "yyyy")
    'MsgBox "Me.DateReported: " & Me.DateReported
    'print annual report for entire yeaar
    If Format(gloGetValue("StartDate"), "mm") = "01" _
    And Format(gloGetValue("EndDate"), "mm") = "12" Then
    Me.DateReported = "For Year: " & _
    Format(gloGetValue("StartDate"), "yyyy")
    Else
    'print report that spans several months
    If Format(gloGetValue("StartDate"), "mm") <> _
    Format(gloGetValue("EndDate"), "mm") Then
    Me.DateReported = "From: " & Format(gloGetValue("StartDate"), "mm/dd/yy")
    Me.DateReported = Me.DateReported & " Thru: " & _
    Format(gloGetValue("EndDate"), "mm/dd/yy")
    End If
    End If
    </pre>


  6. #6
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Need Proper Code? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    For other loungers reading this thread, you can find the code of gloSetValue and gloGetValue in <post#=198890>post 198890</post#>
    Francois

Posting Permissions

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