Kaup, Chester
Chester_Kaup at kindermorgan.com
Thu Oct 30 13:04:44 CDT 2008
I get a blank line after line 1, 4, 7, 12, 15, 18 and 21. I also get 2 blank lines after line 9. What I need is a blank line after lines 3, 6, 9, 12, 15 and 16. Thanks for your ideas. -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Thursday, October 30, 2008 12:34 PM To: accessd at databaseadvisors.com Subject: Re: [AccessD] Blank Lines in report Hi Chester - and if you adjust the code like this: If (cLines Mod (cMaxLine + 1) = 0) Or (cLines Mod (cMaxLine16 + 1) = 0) Then Me.NextRecord = False Me.PrintSection = False End If then what do you see? /gustav >>> Chester_Kaup at kindermorgan.com 30-10-2008 13:47 >>> If I set up the code like this and walk through it all the statements in the if then end if block are executed when the if condition is met (3, 6, 9 etc). The report displays with a blank line every third line. Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer) ' This code adds a blank line by setting the NextRecord and ' PrintSection properties. If cLines Mod (cMaxLine + 1) = 0 Then Me.NextRecord = False Me.PrintSection = False End If cLines = cLines + 1 End Sub If I set up the code like this and walk through it all the statements in the if then end if block are executed when the if condition is met (3, 6, 9 etc). The report displays with no blank lines Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer) ' This code adds a blank line by setting the NextRecord and ' PrintSection properties. If cLines = 3 Or cLines = 6 Or cLines = 9 Or cLines = 12 Or cLines = 15 Or cLines = 16 Then Me.NextRecord = False Me.PrintSection = False End If cLines = cLines + 1 End Sub cLines increments just fine in both cases. I am puzzled. -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Wednesday, October 29, 2008 5:18 PM To: accessd at databaseadvisors.com Subject: Re: [AccessD] Blank Lines in report Hi Chester Did you try my code line? You could also insert a debug line to view what is going on: End If Debug.Print "cLines:" & Str(cLines) cLines = cLines + 1 End Sub /gustav >>> Chester_Kaup at kindermorgan.com 29-10-2008 20:07 >>> Thanks for the idea but turns out I need to do something a little different. The first If cLines statement in the sub detail section works as intended inserting a blank line every third row. The second If cLines statement inserts no blank lines. I have run each separately and have walked through the code. What am I missing? Option Compare Database Option Explicit ' This code declares the cLines variable as an integer, and the ' cMaxLine constant as five. You can set the cMaxLine constant ' to insert a blank line after as many lines as you want. For ' example, to add a blank line after every eight lines in the ' report, set cMaxLine=8. Dim cLines As Integer Const cMaxLine = 3 Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer) ' This code adds a blank line by setting the NextRecord and ' PrintSection properties. If cLines Mod (cMaxLine + 1) = 0 Then If cLines = 3 Or cLines = 6 Or cLines = 9 Or cLines = 12 Or cLines = 15 Or cLines = 16 Then Me.NextRecord = False Me.PrintSection = False End If cLines = cLines + 1 End Sub Private Sub Report_Open(Cancel As Integer) 'This code initializes the cLines variable to zero. cLines = 0 End Sub -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Wednesday, October 29, 2008 11:15 AM To: accessd at databaseadvisors.com Subject: Re: [AccessD] Blank Lines in report Hi Chester Couldn't you introduce a second constant: Const cMaxLine16 = 16 and adjust the code like this: If (cLines Mod (cMaxLine + 1) = 0) Or (cLines Mod (cMaxLine16 + 1) = 0) Then Me.NextRecord = False Me.PrintSection = False End If /gustav >>> Chester_Kaup at kindermorgan.com 29-10-2008 17:02:07 >>> I have some data in a table I need to display in a report. The problem is I need a blank line in the report after the 3rd, 6th, 9th, 12th, 15th and 16th record. I found some code in MS article 208696 but that is only for every nth record. The stumbling block is the last interval. Maybe I could put some blank records in the source data? Chester Kaup -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com