Results 1 to 8 of 8
  1. #1
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    528

    counts the number of records

    I have a form letter as a report, that has 2 subreports that print supplemental information. Currently,
    When there is data that fills this subreport, it fills in , "Grows"


    Do there that counts the number of records that would be displayed... and if it is greater than 0, then print out the normal concatenation... but if it ='s 0, then print out "None".

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,945
    What do you mean by 'normal concatenation'?

    Here is what I do. Have label on report with caption. If subreport does not have data, then display the label.

    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    Me.lblOU.Visible = Not Me.ctrOU.Report.HasData
    Me.lblCO.Visible = Not Me.ctrCO.Report.HasData
    Me.lblRC.Visible = Not Me.ctrRC.Report.HasData
    End Sub
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    528
    Thank you very much June
    What I mean is if there are 10 records in the report I want to see only the last 5 records
    Where I put in a field numbering records in the report these characteristics
    Name: txtcounter
    Control Source: = 1
    Running Sum: Over Group
    Visible: No

  4. #4
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    528
    I have tried with this but did not succeed

    Code:
     If [Seq] Mod 5 = 0 Then
            Me.Detail.ForceNewPage = 5
        Else
            Me.Detail.ForceNewPage = 0
        End If

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,945
    That would not be valid code for what you want.

    What if there are 20 records - what should happen?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    528
    Thank you What is the solution then? If I have 10 records in the report or 12 or 16 .... etc.. I want to show only the last five records, only Is it possible

  7. #7
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,945
    This is a very unusual requirement. Never seen anything like it. Why don't you just limit the report recordset to 5 records? Perhaps:

    SELECT TOP 5 * FROM tablename WHERE {some criteria here} ORDER BY [somefield] DESC;
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  8. #8
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    528
    Thank you very much JuneHe has worked wonderfully Thank you June

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 9
    Last Post: 08-19-2014, 12:41 PM
  2. Why Are Counts Different?
    By johnywhy in forum Queries
    Replies: 9
    Last Post: 01-08-2014, 05:35 PM
  3. Replies: 1
    Last Post: 01-24-2013, 05:50 PM
  4. Replies: 5
    Last Post: 10-26-2012, 08:46 AM
  5. Replies: 6
    Last Post: 07-25-2011, 01:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums