[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 850
  • Last Modified:

Conditionally format Yes/No field in Access 2010

hi All
I had thought this would be straightforward enough but when I went to conditionally format a field on a form as Green for Yes and Red for no - it turns out that Conditional formatting is not available.  The idea is that when the user ticks a box it goes green and when it's unticked, its red...
Any suggestions? As always thank you
0
agwalsh
Asked:
agwalsh
1 Solution
 
RyanProject Engineer, ElectricalCommented:
The checkbox itself has no color, but you can modify the forecolor or back color of the associated label.

Private Sub Check1_AfterUpdate()
  Label2.BackColor = IIf(Check1.Checked, acColorIndexGreen, acColorIndexRed)
End Sub

The other option is to put a box behind both the check and the label, and color its backcolor, which may look more intuitive to the user.
0
 
als315Commented:
You can use combination of Yes/No field and simple field. Look at example
DBbool.accdb
0
 
hnasrCommented:
MrBullwinkle's comment is what you need..
You may use vbGreen and vbRed for colors.

Other thing I noticed is that color will not change unless I manually set the baccolor first. I selected automatic for baccolor and it displayed the same value Background 1. Could be my settings.
0
Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

 
agwalshAuthor Commented:
@als315 - Thanks for that - I see how it works. I've tried that with the attached form mFrmLocations (which has a subform that I want to put the boxes into and is in datasheet view - rather than the continuous forms you have)  and I've tried to set a background text box to green when January is ticked - but it doesn't seem to work. Thanks!
CF-yes-no-box.accdb
0
 
als315Commented:
You have very limited formatting abilities in datasheet view. Try this sample with continuous form.
CF-yes-no-box.accdb
0
 
agwalshAuthor Commented:
Exactly what I wanted - elegant and easy solution. YUM!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now