473,412 Members | 1,873 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,412 software developers and data experts.

Alternative row color with a sub report

Hello.

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

End Sub

Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As
Integer)
Me.Detail.BackColor = 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 5916
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.google. com>...
Hello.

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

End Sub

Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As
Integer)
Me.Detail.BackColor = 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.OpenRecordset("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.BackColor = DLookup("lngColor", "WORK_SHADING", "GroupName = '" &
Me.GroupName & "'")

"Simone" <oi****@hotmail.com> wrote in message
news:fc**************************@posting.google.c om...
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.google. com>...
Hello.

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

End Sub

Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As
Integer)
Me.Detail.BackColor = 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
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...
3
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...
6
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...
24
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
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
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...
2
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...
3
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...
3
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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.