473,803 Members | 3,738 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Alternative row color with a sub report

Hello.

I am using the code below:
-------------------------------------------
Private Sub Detail_Format(C ancel As Integer, FormatCount As Integer)
If Me.Section(0).B ackColor = vbWhite Then
Me.Section(0).B ackColor = 15724527
Else
Me.Section(0).B ackColor = vbWhite
End If

End Sub

Private Sub PageHeaderSecti on_Format(Cance l As Integer, FormatCount As
Integer)
Me.Detail.BackC olor = 16777215
End Sub
-------------------------------------------
The problem I am having is that on each row(detail section) there is a
sub report and I don't know how to access the sub report(detail) back
color to change with the main report.

Any ideas?

Thanks
Simone Dupre
Nov 12 '05 #1
2 5937
I just wanted to follow up on this post that I would like to make it
gray or white depending on the group. Please disreguard the sub report
I eliminated it and now I am using group header.

Example
Group A
1
2
3
all gray

Group A
1
2
3
all white.

I can'get that right, it makes every other row white or gray and I
want all rows for that group white or gray.

Thanks
Simone
oi****@hotmail. com (Simone) wrote in message news:<fc******* *************** ****@posting.go ogle.com>...
Hello.

I am using the code below:
-------------------------------------------
Private Sub Detail_Format(C ancel As Integer, FormatCount As Integer)
If Me.Section(0).B ackColor = vbWhite Then
Me.Section(0).B ackColor = 15724527
Else
Me.Section(0).B ackColor = vbWhite
End If

End Sub

Private Sub PageHeaderSecti on_Format(Cance l As Integer, FormatCount As
Integer)
Me.Detail.BackC olor = 16777215
End Sub
-------------------------------------------
The problem I am having is that on each row(detail section) there is a
sub report and I don't know how to access the sub report(detail) back
color to change with the main report.

Any ideas?

Thanks
Simone Dupre

Nov 12 '05 #2
DFS
Simone,

Doubtless someone can offer a better method (using an array probably), but
here's my hack, which uses a work table to keep track of the shading to
apply to the alternating groups.
1) Create a work table to use with the report:
CREATE TABLE WORK_SHADING
( GroupName text(100) NOT NULL,
lngColor long NOT NULL,
OrderNum byte NOT NULL
);

ALTER TABLE WORK_SHADING
ADD CONSTRAINT PK_WORK_SHADING PRIMARY KEY
( GroupName );
2) Populate the work table with the shading values to apply to the groups.
In the report open event, add this code (note you'll need to change the
asterisked query so the groups and ordering matches the data and ordering on
your report):

Dim db As Database, rs As Recordset
Dim i As Integer, lngColor As Long
i = 1
lngColor = 16777215 'WHITE
Set db = CurrentDb()
db.Execute ("DELETE FROM WORK_SHADING;")
*** Set rs = db.OpenRecordse t("SELECT DISTINCT GroupName FROM TABLE ORDER BY
'however it is ordered on your report';")
Do Until rs.EOF
If lngColor = 12632256 Then
lngColor = 16777215 'WHITE
Else
lngColor = 12632256 'GRAY
End If
db.Execute ("INSERT INTO WORK_SHADING (GroupName, lngColor, OrderNum)
VALUES('" & rs("GroupName" ) & "', " & lngColor & ", " & i & ");")
i = i + 1
rs.MoveNext
Loop
rs.Close
3) Apply the shading colors to the report. In the Detail_Format event of
the Report, add:

Me.Detail.BackC olor = DLookup("lngCol or", "WORK_SHADI NG", "GroupName = '" &
Me.GroupName & "'")

"Simone" <oi****@hotmail .com> wrote in message
news:fc******** *************** ***@posting.goo gle.com...
I just wanted to follow up on this post that I would like to make it
gray or white depending on the group. Please disreguard the sub report
I eliminated it and now I am using group header.

Example
Group A
1
2
3
all gray

Group A
1
2
3
all white.

I can'get that right, it makes every other row white or gray and I
want all rows for that group white or gray.

Thanks
Simone
oi****@hotmail. com (Simone) wrote in message

news:<fc******* *************** ****@posting.go ogle.com>...
Hello.

I am using the code below:
-------------------------------------------
Private Sub Detail_Format(C ancel As Integer, FormatCount As Integer)
If Me.Section(0).B ackColor = vbWhite Then
Me.Section(0).B ackColor = 15724527
Else
Me.Section(0).B ackColor = vbWhite
End If

End Sub

Private Sub PageHeaderSecti on_Format(Cance l As Integer, FormatCount As
Integer)
Me.Detail.BackC olor = 16777215
End Sub
-------------------------------------------
The problem I am having is that on each row(detail section) there is a
sub report and I don't know how to access the sub report(detail) back
color to change with the main report.

Any ideas?

Thanks
Simone Dupre

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

28
2402
by: Paul McGuire | last post by:
Well, after 3 days of open polling, the number of additional votes have dropped off pretty dramatically. Here are the results so far: Total voters: 55 (with 3 votes each) Votes for each choice or group of choices: Any J 81 J2 78 Any C 40 C1 29 Any D 9
3
1714
by: compu_global_hyper_mega_net_2 | last post by:
I'd like to do something like: delete from a where id in (select * from b where pattern like '%something%') I may or may not have the syntax right. I know that this sort of subquery isn't available until mysql 4.1. 4.1 beta is taking too long to release and I need something now, so here's what I'm doing now: replace a (id) select -refId id from b where pattern like
6
2536
by: Andy Fish | last post by:
Hi, I want to use an anchor tag to invoke some javascript and I've read that it's bad form to use <a href="javascript:foo()"> I've read endless usenet posts and hint sites on the net, they all suggest different things and I can't get any kind of consistency, and I can't find any solution that works properly for IE, opera and mozilla. many of the recommended solutions go something like this:
24
4513
by: Wim Roffal | last post by:
Is there a possibility to do a string replace in javascript without regular experessions. It feels like using a hammer to crash an egg. Wim
13
5834
by: Mark | last post by:
I am looking for a switchboard creator alternative for my MDB. Can anyone help me? Thanks for your help, Mark
115
14198
by: TheAd | last post by:
At this moment I use MsAccess and i can build about every databound application i want. Who knows about a serious open source alternative? Because Windows will be a client platform for some time, i prefer a solution that (also) supports Windows. On the net I found a number of products that i looked at, but none of them gave me the impression of a serious candidate at this moment (KNoda, Gnome DB Manager, InterBase...). 2 additional...
2
2831
by: mark | last post by:
I've got an 83-page report which contains an Microsoft Graph 8 Chart, but the report takes FOREVER to format, probably because the row source is a bit complex: TRANSFORM Sum(qryCallsSummarizedByArbitraryYear.CallCount) AS SumOfCallCount SELECT qryCallsSummarizedByArbitraryYear.DateByYear FROM qryCallsSummarizedByArbitraryYear GROUP BY qryCallsSummarizedByArbitraryYear.DateByYear PIVOT qryCallsSummarizedByArbitraryYear.;
3
10673
by: google | last post by:
I have a database with four table. In one of the tables, I use about five lookup fields to get populate their dropdown list. I have read that lookup fields are really bad and may cause problems that are hard to find. The main problem I am having right now is that I have a report that is sorted by one of these lookup fields and it only displays the record's ID number. When I add the source table to the query it makes several records...
3
2513
by: Ann Marinas | last post by:
Hi there, I was wondering if you guys could help me out regarding the scenario I am in... Whenever I write an asp.net application in the office, I tend to save my codes in a Dev Server. This server contains crystal reports, which is not available on my work's qa and production server. I've got full control of the Dev server, but on the QA and Prod server, I could only upload my web apps and not be able to install plugins or any other...
0
9703
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9565
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10550
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10317
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9125
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5501
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4275
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3799
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2972
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.