Using VBA to change label formatting for yes/no control when No

Philocthetes

Has a great deal to learn
Local time
Yesterday, 22:17
Joined
Dec 19, 2017
Messages
28
I'm running a large-scale book digitization project and most of our work will be destructive, cutting books to run them through sheet-feed scanners.

An unknown subset of those books are only-known copies that need to be kept intact and transferred to our Archives. My database design has a Yes/No field Archives_Copy_Present, and No values need to be very obvious on some forms.

The 'plain logic' I want to apply is:
If Archives_Copy_Present is No, then change the font color of ArchivesLabel to Red.
I've tried messing around with formatting code I got from recording in Excel. I've Dimmed variables as Label, and tried object names like Forms!Print_QC!ArchivesLabel with no luck so far. Please help me face-palm at the obviousness of what I'm missing.
 
if you are using a checkbox for the yes/no field,
you must know the LABEL name that the checkbox is attached to,
then set the color of the label.
Code:
if Archives_Copy_Present.value then
  lblArcCopyPresent.forecolor = vbBlack
else
  lblArcCopyPresent.forecolor = vbRed
endif

but if you are not using checkbox for the yes/no, but rather a text box (tho i dont know why)

Code:
if Archives_Copy_Present.value then
  txtBox.backcolor = vbWhite
else
  txtBox.backcolor = vbRed
endif
 
For myself, I would set the FORM's background color based on the checkbox, not a label's. THAT should get people's attention.
 
I agree with Mark --if it's important, then the more conspicuous the better.
 
Last edited:
Its not about being conspicuous... its about


G
E
T
T
I
N
G

A
T
T
E
N
T
I
O
N
 
What type of form do you have
 
I've tried messing around with formatting code I got from recording in Excel. I've Dimmed variables as Label, and tried object names like Forms!Print_QC!ArchivesLabel with no luck so far.
If you have code, and you haven't posted your code, then what you are missing is posting your code. How can we tell what your code is missing without looking at your code???
hth
Mark
 

Users who are viewing this thread

Back
Top Bottom