Page 2 of 2 FirstFirst 12
Results 16 to 27 of 27
  1. #16
    MunroeM is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2015
    Posts
    55

    I tried but i get a pop up saying " Cannot open a databse created with a previous version of your application"

    At home im on Windows 10 running access 2016. At work i run windows 7 access 2010

  2. #17
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    I opened it and allowed Access to convert it. Works just fine.

    Here is another link that uses the same technique https://support.microsoft.com/en-us/kb/210350

    That code is designed to run from a general module but I modified to run it behind report. I put textbox named TotRec in your report footer, it can be set not visible.

    Code:
    Option Compare Database 'Use database order for string comparisons.
    Option Explicit
    Public TotCount As Integer
    
    Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
    With Me
       TotCount = TotCount + 1
       If TotCount = .TotRec Then
            .NextRecord = False
       ElseIf TotCount > .TotRec And TotCount < 25 Then
            .NextRecord = False
            .TemmisTagNum.ForeColor = vbWhite
            .TemmisNum.ForeColor = vbWhite
       End If
    End With
    End Sub
    You will have to add code to set the ForeColor for every textbox or to not be visible. Notice that the white font will show through the alternate record grey color. Handling this with code gets tricky. Or don't use alternate color.

    Now if you expect the records to exceed 1 page, probably need some code modification but I have no idea what.

    Will the table always have 175 records? Alternatively, you could sort records so the ones without a TemmisNum follow the ones with then use an expression in textbox to force the TemmisTagNum to not display if TemmisNum Is Null.

    =IIf([TemmisNum] Is Null, Null, [TemmisTagNum])

    This way I suppose will always have some blank rows but without any code to fill up last page.

    I add records (total 44) and tested with a sort on expression: =Nz([TemmisNum],"z") and secondary sort on TemmisTagNum. For some reason record 057 sorts to the top. I had to delete and re-enter the record. Get a 7 page report with about 5 pages of blank rows (the last page has lot of white space because it is not 'filled').
    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. #18
    MunroeM is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2015
    Posts
    55
    Quote Originally Posted by June7 View Post
    I opened it and allowed Access to convert it. Works just fine.

    Here is another link that uses the same technique https://support.microsoft.com/en-us/kb/210350

    That code is designed to run from a general module but I modified to run it behind report. I put textbox named TotRec in your report footer, it can be set not visible.

    Code:
    Option Compare Database 'Use database order for string comparisons.
    Option Explicit
    Public TotCount As Integer
    
    Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
    With Me
       TotCount = TotCount + 1
       If TotCount = .TotRec Then
            .NextRecord = False
       ElseIf TotCount > .TotRec And TotCount < 25 Then
            .NextRecord = False
            .TemmisTagNum.ForeColor = vbWhite
            .TemmisNum.ForeColor = vbWhite
       End If
    End With
    End Sub
    You will have to add code to set the ForeColor for every textbox or to not be visible. Notice that the white font will show through the alternate record grey color. Handling this with code gets tricky. Or don't use alternate color.

    Now if you expect the records to exceed 1 page, probably need some code modification but I have no idea what.

    Will the table always have 175 records? Alternatively, you could sort records so the ones without a TemmisNum follow the ones with then use an expression in textbox to force the TemmisTagNum to not display if TemmisNum Is Null.

    =IIf([TemmisNum] Is Null, Null, [TemmisTagNum])

    This way I suppose will always have some blank rows but without any code to fill up last page.

    I tested this with a sort on expression: =Nz([TemmisNum],"z") and secondary sort on TemmisTagNum. For some reason record 057 sorts to the top. I had to delete and re-enter the record. Get a 7 page report with 5.5 pages of blank rows.
    I actually want all the lines to have the same background colour so that wont be an issue.

    The Table always has 175 records as there are 175 tags numbered 001 to 175. How many pages for the report depends on the amount of tags currently signed out at the time of printing. if 78 tags are currently signed out then there should be 4 pages to print. 3 complete pages and 1 with 3 lines complete.

    Can that IIf statement use the "SignedOut" field in the table to set the TemmisTagNum to null? But if i use that does it actually change the record value to null?

  4. #19
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Yes, the IIf expression can use the SignedOut field as criteria for display of TemmisTagNum and it can be in query. No, it does not actually change value in table.

    Now if you don't want all 175 records to print, only the signed out tags and enough extra records to fill up the last page, that might be possible but won't be easy.
    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.

  5. #20
    MunroeM is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2015
    Posts
    55
    Quote Originally Posted by June7 View Post

    Now if you don't want all 175 records to print, only the signed out tags and enough extra records to fill up the last page, that might be possible but won't be easy.
    That is exactly what i want.

  6. #21
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Review options - all involve VBA:

    1. temp table that is populated with just enough records to fill out report - method described by micron in post 2

    2. the code in post 17 somehow modified to handle multiple pages

    3. some way of restricting a query of the 175 records to just enough to fill out report - method and code not yet determined

    Right now I see option 1 as the easiest.
    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.

  7. #22
    MunroeM is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2015
    Posts
    55
    I can get a temp table set up with the completed records using a append querry.

    I just dont know how i would make it so it would add all the "blank records" i would need to fill the final page

  8. #23
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Something like:

    Code:
    CurrentDb.Execute "DELETE FROM temptable"
    CurrentDb.Execute "INSERT INTO temptable SELECT * FROM TemmisTagT WHERE SignedOut = True"
    intFillCount = 25 - DCount("*", "temptable") Mod 25
    For x = 1 To intFillCount
        CurrentDb.Execute "INSERT INTO Temptable(TemmisTagNum) VALUES(Null)"
    Next
    or this variation
    Code:
    CurrentDb.Execute "DELETE FROM temptable"
    intFillCount = 25 - DCount("*", "TemmisTagT", "SignedOut=True") Mod 25
    For x = 1 To intFillCount
        CurrentDb.Execute "INSERT INTO Temptable(TemmisTagNum) VALUES(Null)"
    Next
    In this case the report RecordSource would be a UNION query:
    SELECT TemmisTagNum, TemmisTag, ... FROM TemmisTagT WHERE SignedOut=True
    UN ION SELECT TemmisTagNum, Null, ... FROM temptable;

    Is this a multi-user split db? Temp table must be in the frontend.
    Last edited by June7; 12-22-2015 at 06:21 PM.
    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.

  9. #24
    Micron is offline Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    Am I wrong or should this CurrentDb.Execute "DELETE FROM temptable" be CurrentDb.Execute "DELETE * FROM temptable"

  10. #25
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Since the entire record is deleted there is no need to reference field(s), neither explicitly nor with wildcard.
    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.

  11. #26
    Micron is offline Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    OK. It seems to be the default syntax for a query object, as in
    DELETE tblRawData.*
    FROM tblRawData;
    It's also how it's written at the MS Developer site, but I've never tried it without the wildcard. I always thought it was needed.

  12. #27
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Works either way.
    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.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Include "blank" child records.
    By Homegrownandy in forum Access
    Replies: 5
    Last Post: 11-10-2015, 06:49 PM
  2. Replies: 1
    Last Post: 09-07-2015, 08:00 AM
  3. Replies: 17
    Last Post: 02-13-2015, 06:24 AM
  4. Replies: 3
    Last Post: 08-21-2014, 08:32 AM
  5. Export "Query or Report" to a "Delimited Text File"
    By hawzmolly in forum Import/Export Data
    Replies: 3
    Last Post: 08-31-2012, 08:00 AM

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