Solved Setting Colors in Report On Load Event (1 Viewer)

AJJJR

Registered User.
Local time
Today, 11:04
Joined
Mar 19, 2018
Messages
33
This should be simple but I can't seem to figure out how to do it. I want to set the colors of a report to a Public Variable BColor. I'm using the On Load Event and can get it to work with the report detail but the Header and Group Footer are eluding me.

This is what the design view of the report looks like:

DesignView.PNG

and this is the Report View:

FormView.PNG

The code in the On Load Event, that I can get to work (The Detail) is:

Me.Section(acReportDetail).BackColor = BColor

I've tried a lot of things to change the color of the Report Header and the Expr1 Footer (The name for that is grpPercents)

Would really appreciate any help offered, I'm at the point now where I'm making stuff up just to see if it will work.

Thanks
 

arnelgp

error reading drive A:
Local time
Tomorrow, 02:04
Joined
May 7, 2009
Messages
9,336
you can type Me. to show you the intellisense.
then you can put the color:

Me.PageHeaderSection.BackColor = BColor
Me.Detail.BackColor = BColor
Me.GroupHeader0.BackColor = BColor
etc...
 

AJJJR

Registered User.
Local time
Today, 11:04
Joined
Mar 19, 2018
Messages
33
you can type Me. to show you the intellisense.
then you can put the color:

Me.PageHeaderSection.BackColor = BColor
Me.Detail.BackColor = BColor
Me.GroupHeader0.BackColor = BColor
etc...

HI -- Tried that and initially got a compile error, on the "Me.PageHeaderSection.BackColor = BColor" line

Method or Data Member Not Found

I commented out that line, leaving only "Me.Detail.BackColor = BColor" and did not get an error but the color of the detail did not change.

I don't actually have a problem with the detail as:

Me.Section(acReportDetail).BackColor = BColor

is working for the detail.

The two sections I'm having trouble with are the PageHeader and the Expr1Footer (I think it's called a group footer)

Any other ideas?

Thanks again
 

AJJJR

Registered User.
Local time
Today, 11:04
Joined
Mar 19, 2018
Messages
33
HI -- Tried that and initially got a compile error, on the "Me.PageHeaderSection.BackColor = BColor" line

Method or Data Member Not Found

I commented out that line, leaving only "Me.Detail.BackColor = BColor" and did not get an error but the color of the detail did not change.

I don't actually have a problem with the detail as:

Me.Section(acReportDetail).BackColor = BColor

is working for the detail.

The two sections I'm having trouble with are the PageHeader and the Expr1Footer (I think it's called a group footer)

Any other ideas?

Thanks again
Sorry, somehow missed the line

Me.GroupHeader0.BackColor = BColor

If I use that I get the same error
 

Micron

AWF VIP
Local time
Today, 14:04
Joined
Oct 20, 2018
Messages
2,795
The value depends on whatever color the user has chosen.
That is of no help whatsoever. Maybe it's a value from a colour picker. Maybe it's Hex. Maybe it's a string. Maybe it's RGB. Maybe it's a vb constant.
 

AJJJR

Registered User.
Local time
Today, 11:04
Joined
Mar 19, 2018
Messages
33
O.K. I figured out the header. It's:

Me.Section(acHeader).BackColor =
 

Micron

AWF VIP
Local time
Today, 14:04
Joined
Oct 20, 2018
Messages
2,795
Ok. I got it to work using vba but I knew what type of data I was working with.
Good luck.
 

arnelgp

error reading drive A:
Local time
Tomorrow, 02:04
Joined
May 7, 2009
Messages
9,336
you can see all the Member of acSection by going to Object browser (VBA press F2) and type acSection on the combobox search area.
 

AJJJR

Registered User.
Local time
Today, 11:04
Joined
Mar 19, 2018
Messages
33
you can see all the Member of acSection by going to Object browser (VBA press F2) and type acSection on the combobox search area.
arnelgp
Thanks very much. It turned out that it was GroupLevel2, so the syntax is

Me.Section.(acGroupLevel2Footer).BackColor = BColor

You Sir, are a warrior. I've seen you here for years.

Thanks Again
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom