473,387 Members | 1,844 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,387 software developers and data experts.

Formatting in Report

Hi,

I have an access report that consists 2 txtbox fields which are total actual and total estimate. What I need is if total actual > total estimate change the backcolor to red. I created an if and then statement, the only problem is that it didn't check the whole records, it only check the first record and change the whole 2 fields to red for the whole report regardless the value on the next record, then I changed the if and then statement to case for looping but it didn't even change color now. Please help... I'm new in VBA
here is my case statement:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Report_Activate()
  2. For a = 1 To nrecord
  3.  
  4. If txtactual.value > txtestimate.value Then results = x
  5.  
  6. If txtactual.value < txtestimate.value Then results = y
  7.  
  8.     Select Case results
  9.         Case x
  10.  
  11.             txtactual.BackColor = 255
  12.  
  13.             txtestimate.BackColor = 255
  14.  
  15.  
  16.         Case y
  17.  
  18.             txtactual.BackColor = 12632256
  19.  
  20.             txtestimate.BackColor = 12632256
  21.  
  22.     End Select
  23.  
  24. Next i
  25.  
  26.  
  27.    End Sub
Apr 23 '07 #1
3 1365
MMcCarthy
14,534 Expert Mod 8TB
In report design view click on the textbox that you want to change colour. Now go to the Format menu and choose Conditional Formatting. Change the condition to Expression is and enter

Expand|Select|Wrap|Line Numbers
  1. txtActual > txtEstimate
then set the format for the fill colour or text colour if the condition is true.

Mary
Apr 24 '07 #2
In report design view click on the textbox that you want to change colour. Now go to the Format menu and choose Conditional Formatting. Change the condition to Expression is and enter

Expand|Select|Wrap|Line Numbers
  1. txtActual > txtEstimate
then set the format for the fill colour or text colour if the condition is true.

Mary
It worked thank you......
Apr 24 '07 #3
MMcCarthy
14,534 Expert Mod 8TB
It worked thank you......
You're welcome.
Apr 24 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Eddy Bee | last post by:
Hi there, I'm encountering an inexplicable problem with page formatting in reports. Here's the easiest way to explain it: The Detail section of my report contains two elements: And let's...
8
by: Mike MacSween | last post by:
tblCourses one to many to tblEvents. A course may have an intro workshop (a type of event), a mid course workshop, a final exam. Or any combination. Or something different in the future. At...
2
by: Von Bailey | last post by:
I have a form where the conditional formatting is set on some fields to bold if certain conditions are met. However, when the conditions are met some of the data that is to bold is either not...
5
by: Andrew Chanter | last post by:
Does anyone know a way you can use conditional formatting to create a banded style view as is commonly seen on the internet. (In othe words the first record appears on a gray background, the 2nd...
2
by: dcyale | last post by:
I have a report with the following paragraph: ="This BA presents a " & & " determination for the " & & " and associated habitat. We would appreciate you processing the biological opinion by " &...
5
by: CarrieR | last post by:
I am working within a DB I have been devolping in Access 2003, and have encountered a report coding issue I was hoping someone could help me with: I have 18 reports, each running off some smaller...
5
by: dancole42 | last post by:
I have a question regarding the DoCmd.OutputTo function. I have an invoice report that shows all of the invoices for a particular date. I want to create a button that will export each page of...
2
by: penaloj | last post by:
I am assembling a database of scientific names, e.g. Acer saccharum Marshall, sugar maple. The first two elements (genus and species) should be italicized in the report, the third element (author)...
10
by: sara | last post by:
Hi - I have a report that is 14 columnar sub-reports (Line up: Position- holders in each of our 14 locations - Manager, Assistant Manager, Receiving, Office, etc). I output directly to PDF...
4
by: riaane | last post by:
Please help: I have Conditional Formatting on a Report Field that fills the background Red if the criteria is met. This displays correctly in Report View, however, when I "OutputTo" this report to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...

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.