[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Alternate backcolor in Access Report

Posted on 2011-10-24
9
Medium Priority
?
686 Views
Last Modified: 2012-05-12
I've got a report/sub-report is basically a list of activities, and their sub-activities.  To make the report a bit easier to read, I've added a light grey color as the alternate backcolor for both the main and subreports.

The rows alternate colors properly, until they encounter a record where the subreport contains records.  In those cases, the parent record retains the background color of the previous record.

I've played around with a variety of settings, but cannot get this to operate the way I expect.  I've attached an image (with most of the page blanked out to hide proprietary information) so you can see what I mean.  Rows 2 and 13 are the ones which are not working properly.  alternating rows
0
Comment
Question by:Dale Fye
  • 5
  • 4
9 Comments
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 37020163
Not sure buddy, this works fine for me.
(Simple main/sub form, Main record and subform in the detail section, subform can shrink=Yes)

Is this only form this one main/subform?, and any of them...?
(create simple Parent/child tables and forms...)
Any code that might reset the alt color?

Can you show us what sections your controls are in?
(Screenshot of the main report in Design View, or perhaps post a simple DB that demonstrates this issue)
0
 
LVL 49

Author Comment

by:Dale Fye
ID: 37020493
Jeff,

Was hoping you might weigh in on this, an have a quick answer other than: "post a simple database"  ;-)

Will post back, with sample database, in a few
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 37020593
LOL

Yeah I was goofing around with grouping and moving things around in the group headers and footers, but I could no recreate.

But it just seems to me like somehow the report is "resetting" the Alt color sequence when a Parent record with child records is found...

Jeff

0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
LVL 49

Author Comment

by:Dale Fye
ID: 37020634
Here is the sanitized version.
Report-AltBackcolor.accdb
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 37020857
The issue seems to be that since the Main report and the subreport have the same source, the report "resets" the Alt color because it thinks the series is starting again (with each main record with child records).

Perhaps you could use a temp/static table for the sub?

Also note that the Alt color appears fine when the report is opened in Report View.


These are my first observations, still looking at other options.

Perhaps someone else will see something I may be overlooking in the mean time....
0
 
LVL 49

Author Comment

by:Dale Fye
ID: 37021144
Jeff,

Thanks for looking.  I almost never use Report View, so I didn't event think to look at that.  Would still prefer to go with Print Preview, if we can figure out what is going on.
0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 1000 total points
ID: 37022113
I'd just go "Old School" with something like this in the main report:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    If txt_Row Mod 2 = 0 Then
        Me.Section(0).BackColor = 12632256
    Else
        Me.Section(0).BackColor = 16777215
    End If
End Sub


I had to tweak the design and position of the subReport to hide the left part of the detail section, if it was Grey...

Let me know...

;-)

Jeff
Report-AltBackcolor.accdb
0
 
LVL 49

Author Closing Comment

by:Dale Fye
ID: 37023981
Jeff,

Just realized that what it is doing is setting the backcolor of every record where the subform contains records to the default color.  When I changed the backcolor and Alt Back Color to alternate grey/white instead of white/grey, the background of all the records with subforms turned grey.

So, I think the old-school method you mention above will have to do.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 37024425
Yeah,

Knowing full well that you probably have a reason for everything, I just thought that dropping the old school method "on top" of your design would at least give you the effect you were looking for.
I was not sure if you had to use Alt Backcolor because of the low overhead, or if a code solution was and option.

Glad I could help a fellow Expert!

;-)

Jeff

0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question