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

Access 2007 - Conditional Formatting Report Fields with VBA

Hi All,

I have a report that is going to have 30 odd fields each containing a number, the number is the wind speed.

I want to format the background of the field based on the value of the text box. I have code that formats the background, but I am having issues with it. They are listed below
1. I cannot get it to use # values i.e. #e4fefc
2. I can only get it to format when I put in detail_click, detail_format does not seem to work
3. When I click on a line all the other fields are formatted according to that selected lines value not it’s own value.

This is the code I am using
Expand|Select|Wrap|Line Numbers
  1. Select Case WindSpeed_03h.Value
  2.         Case 6
  3.             Me.WindSpeed_03h.BackColor = "#e4fefc"
  4.         Case 7
  5.             Me.WindSpeed_03h.BackColor = "#adfbf7"
  6.         Case 8
  7.             Me.WindSpeed_03h.BackColor = "#9afaf6"
  8.         Case 9
  9.             Me.WindSpeed_03h.BackColor = "#73f8f2"
  10.         Case 10
  11.             Me.WindSpeed_03h.BackColor = "#e4fefc"
  12.         Case 11
  13.             Me.WindSpeed_03h.BackColor = "38fb83"
  14.         Case 12
  15.             Me.WindSpeed_03h.BackColor = "#09fe15"
  16.             Me.WindSpeed_03h.FontBold = True
  17.         Case 13
  18.             Me.WindSpeed_03h.BackColor = "#09fe15"
  19.             Me.WindSpeed_03h.FontBold = True
  20.         Case 14
  21.             Me.WindSpeed_03h.BackColor = "#13fe00"
  22.             Me.WindSpeed_03h.FontBold = True
  23.         Case 15
  24.             Me.WindSpeed_03h.BackColor = "#43fb00"
  25.             Me.WindSpeed_03h.FontBold = True
  26.     End Select
  27.  
Basically I want it to look like windguru.

Can someone give me a hand on these problems please.
Nov 29 '10 #1
3 2316
NeoPa
32,556 Expert Mod 16PB
Rhys, First and foremost, you can only have one question per thread. The site has rules and this one makes working much easier.

As for your hex values, they are not strings. You need the format &H2B5C2.

As for number three - it sounds like you're using Continuous Forms. Why Values in Unbound Form Controls do not Persist may help you to understand why this is, even if your controls are bound (only the value is maintained separately for bound forms. Not the definition).

If there's anything you still need help with (The hex value part can stay in here) then please post it separately.
Nov 29 '10 #2
Hi NeoPa,

Sorry about that, I assumed that because I was reffering to one block of code, I was asking "one" question.

I have reposeted point 3, please note I am creating a report not a form.
Nov 29 '10 #3
NeoPa
32,556 Expert Mod 16PB
Rhys Gottwald:
please note I am creating a report not a form.
The concept covered by the article holds as well for reports as it does for forms. I assume you looked at the contents rather than just the title? I can explain in more detail if you feel that is necessary.

PS I looked for another post of point #3, but only found a thread which had no specific questions in it (which I deleted).

If you post the third question clearly and post a link to it here, I will look at it for you.
Dec 3 '10 #4

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

Similar topics

0
by: VictorReinhart | last post by:
Hi, Access 2000, Conditional Formatting. I want to change the background color of a cell if its value differs from the same cell in the prior row (a "control break"). What can I do? Thank...
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...
1
by: dddsssdddsss | last post by:
A comment and a question To anyone who is using conditional formatting, beware that in Access 2007 the color pallette is not the same as the color pallette in Access 2003. So if you have a...
2
by: Filips Benoit | last post by:
Dear All, Access 2003 adp on SQL_server 2005 A continious form showing 1 month based on table 'CALENDAR_MONTH_GRID' and fill with a SP. Fields: Companyname, Day1, day2, etc. The value in the...
16
by: Neil | last post by:
I posted a few days ago that it seems to me that the Access 2007 rich text feature does not support: a) full text justification; b) programmatic manipulation. I was hoping that someone might...
7
by: wongray | last post by:
Hi, I have an access question. it is possible to set a formula in access to check the current date - the date field.? Kindly advise. Regards Raymond
1
by: DavidB | last post by:
I have a report that (among other data) lists three different date fields from one of my tables. This is a validation report in that date #1 and date #2 should be earlier than date #3. The report...
2
by: EORTIZ | last post by:
I have a report that is grouped by a field. I have looked for ways in which it would be possible to obtain an individual report for each group to export to PDF. Since if I have all groups in the...
3
by: Brett Barry: Go Get Geek! | last post by:
Hello, I just started using Access 2007 after using Access 2003 for a long time. I've created all my queries and they work fine. However, either I forgot or it has changed but, how do I create a...
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: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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: 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...

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.