I would like to be able to have row dividers every 4 or 5 rows in my report instead of alternating colors every row. Is that possible in Access 2007 or am I going to have to look into something like Crystal Reports to be able to do this?
I would like to be able to have row dividers every 4 or 5 rows in my report instead of alternating colors every row. Is that possible in Access 2007 or am I going to have to look into something like Crystal Reports to be able to do this?
Can be done in Access. Requires VBA code in the report Detail section format event. Need a line control in the Detail section and code like:
Me.linename.Visible = expression that evaluates to true or false
The real trick is figuring out the expression - how to determine every fifth record.
Try this.
Create a textbox named tbxCount in Detail section with ControlSource of: = 1
Set RunningSum to OverAll.
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.Line11.Visible = Me.tbxCount Mod 5 = 0
End Sub
Be aware, Format event executes only in PrintPreview or straight to printer.
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.
June7,
It's been a long, long time since I wrote any code within Access. WHere and how do I enter the "Private Sub... End Sub" code?
Thanks for the help..
Fred615
Can be done in Access. Requires VBA code in the report Detail section format event. Need a line control in the Detail section and code like:
Me.linename.Visible = expression that evaluates to true or false
The real trick is figuring out the expression - how to determine every fifth record.
Try this.
Create a textbox named tbxCount in Detail section with ControlSource of: = 1
Set RunningSum to OverAll.
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.Line11.Visible = Me.tbxCount Mod 5 = 0
End Sub
Be aware, Format event executes only in PrintPreview or straight to printer.
Open report in design view, select the Detail section (click on Detail bar), on Events tab of Properties dialog, select [Event Procedure] in the Format event, double click the ellipses (...) to go to procedure in VBA editor, type code.
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.
Are your controls actually named Line11 and tbxCount or are those just the names from my example? Must use your control names.
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.
I missed the part of your original response about a "line control". I now added a line in the Dtail section and changed the Me.Line to Me.Line19. Now I am able to print normally, however, I still am not seeing the line every 5th row. See enclosed capture..
I notice that I am now getting line numbers on the right side which is probably a good thing for future reference work.
Any other thoughts on the phantom lines?
Thanks...
It works fine in my project. If you have the controls correctly referenced in the code and the code is correct syntax and viewing report in PrintPreview, don't know why not working for you. So would have to examine your project to analyse issue.
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.