Hello All,
I'm not sure if this is possible and have been unsuccessful in my attempts.
Scenerio: I have a report with several fields. If the data in field X = Y then shade the entire row.
I've been attempting to loop through the report using the following in the OnFormat Event: -
For Each ctl In Me.Section(0).Controls
-
If ctl.Column(4) = "text string here" Then
-
Me.Section(0).BackColor = RGB(255, 255, 255)
-
Else
-
Me.Section(0).BackColor = RGB(192, 192, 192)
-
End If
-
Next
-
Is what I'm attempting even possible in a report?
Bender
4 1925 Megalog 378
Recognized Expert Contributor
I've used Conditional Formatting to do this. I'm not sure if there's a way though VBA to apply the entire row backcolor at once.
So in your case, you might want to try highlighting the cells in the row you want to format, go to Conditional Formatting, and select "Expression is:"
Then put in your condition: [fieldname]="text string here"
Apply the font color/style, or background fill color, and see if it looks good enough for you.
FishVal 2,653
Recognized Expert Specialist
Something like the following: -
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
-
....
-
If X = Y Then Me.Detail.BackColor = ....
-
.....
-
End Sub
-
I've used Conditional Formatting to do this. I'm not sure if there's a way though VBA to apply the entire row backcolor at once.
Megalog,
Thank you for your quick reply. However, the problem with using conditional formatting is that there are 11 text strings to search for. CF allows for only 3 which is why was I trying this using VBA.
Bender
Thank You All, for your assistance.
With some minor changes I was able to shade the rows in the report. Here is the code in case it can assist others. -
Private Sub Detail_Format(Cancel as Integer, FormatCount as integer)
-
For Each rec In Me.Reports.Controls
-
If X = Y Then
-
Me.Section(0).BackColor = RGB(192, 192, 192)
-
Else
-
Me.Section(0).BackColor = RGB(255, 255, 255)
-
End If
-
Next
-
Thanks Again,
Bender
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: deko |
last post by:
I can't move a multi-page report to the last record unless I keep the popup
form (that defined it's subreports) open.
DoCmd.OpenReport "rptStandard", acViewNormal
DoCmd.Close acForm, "frmReportOptions" <== popup form
This is the error I get when I try to move to the last page of the report
*after* closing the popup:
"This expression is typed incorectly, or is too complex to be evaluate...."
|
by: jeffgeorge |
last post by:
Using a bit of code to produce alternate line shading in a report.
Seems it should work for a form as well but no luck. Does anyone have
any ideas what I need to change or if it is even possible to alternate
shade a form???
Private Sub Alternate_Detail_Format(Cancel As Integer, FormatCount As
Integer)
Const vbLightGrey = 12632256
|
by: pelcovits |
last post by:
I am trying to set up an unbound form to enter report criteria.
I've followed the MS Office Assistance document: "Create a form to
enter report criteria" which describes how to enter data (such as
dates) in a text box. This procedure works fine. However, I also need
to enter data from a combo box and I cannot get this to work. On my
form I've created an unbound combo box named "Name". In the query bound
to the report I've entered the...
|
by: Richard Yardley |
last post by:
I have a mailing label report and would like to remove the space taken up by
rows with no info (move the other rows up).
I am a beginner using MS Access 2000 and would appreciate any help.
Thanks
Richard
|
by: buck |
last post by:
reports/ can we alternate formatting such as "no shading" and then
"shading" for multiple records such as a phone directory in Access2000
reports
| |
by: |
last post by:
hi,
i have a form on which a user can choose specific criteria such as dates
etc, in order to filter the report that is called from the form.
i do this by using the Where section of the docmd.openreport as follows
DoCmd.OpenReport stDocName, acPreview, , strWhere
where strWhere is a string dependant on the choices the user makes in the
|
by: Bob Alston |
last post by:
I am looking for Access reporting add-in that would be easy to use by
end users. My key focus is on selection criteria. I am very happy with
the Access report writer capabilities. As far as development of
reports, it is certainly fine in my book.
But for end-users, with little experience or training, it would be nice
to have an easy way to handle various selection criteria, perhaps with
relatively stock reports. I see easy to use by...
|
by: rinmanb70 |
last post by:
I have a QBF form/query and a report from the QBF that shows the
results of the QBF. I would like to show the criteria on the report
that was used in the QBF to get the info on report. I can't find how
to do this except to show the "hard for users to understand" SQL WHERE
statement. Anyone have a better way?
|
by: Ceebaby via AccessMonster.com |
last post by:
Hi All
Here's hoping someone can help me with this.
I have a report based on a query where the criteria for 4 of the fields is
set from an unbound form. I want the user to be able to select any
combination of the combo boxes, some might not be selected etc etc.
ie they may want to select the area and ward to show on the report but not
the case officer or the property type
|
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...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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...
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |