Hi again, cheaptrinket!
I've posted your database again for download at:
http://www.hammerdata.com/Google/
There are two techniques illustrated.
The first is the simple case. Conditionally formatting a control based
on a value.
Take a look at the new form I added. It's called
HoldsViewingActiveDateSingleForm. It's just like your original form,
except that it defaults to SingleForm view. Step through the records
and you'll see that when Booked is checked, the Name is red. If you
check and uncheck Booked, you'll see it change from red to black to
red, etc.
Look at the module behind the Form. You will see two identical event
proceudres. One runs each time you move between records (FormCurrent),
the other runs when the Booked checkbox value is changed. The code is
simple:
Private Sub Form_Current()
If Booked = True Then
Me!Name.ForeColor = vbBlack
Else
Me!Name.ForeColor = vbRed
End If
End Sub
You can change most properties using this method. Check out the Access
Help on the particular property you want to change to see the
available options and how to apply them.
*****************************************
The second technique is trickier and, as I warned you on your previous
question, a bit kludgy. Here's the problem: You want to change the
font color on a subform that is displaying as continuous forms. This
means that you can see several forms at once. This means that,
changing the font color of the Name on one subform based in its Booked
value will change *all* the Names to red, regardless of their Booked
value. In order to get around this, we use a trick employing the
Format property of a text box bound to a Yes/No field. We can't
actually change the font color of Name, but we can still do something
to point it out. Here's how this works:
* You have a Yes/No field called Booked.
* I created a text box on your original subform called
ctlNotReallyBooked, located just above the Name control. I bound it to
the Booked field. We now have a text box bound to a Yes/No field.
* I set its Back Style and Border Style to Transparent, so it's not
normally visible to User.
* I set its Forecolor to Red and its Font Weight to Bold, so it will
be attention-grabbing.
* Here's the important part. The Format is set to
;;"v Not Really Booked v"
If you open this form, you will see that those records where booked is
not checked have Not Really Booked in red letters above the Name. The
trick works like this:
The Yes/No Format has three parts.
1. Does nothing, just needs a ; as a placeholder
2. Indicates what value to show if the field is True
3. Indicates what value to show if the field is False
So, our Format statement says to Access:
If Booked is True, leave the control blank. If Booked is False, print
v Not Really Booked v in bold red letters. If you want it to say
something else, just change the text in the Format property for
ctlNotReallyBooked.
This works because we are changing the output format of a record
value, and Access knows how to let continuous forms show different
record values, even though it uses the same font colors, etc. for all
the forms.
Additional Resources:
------------------------
Look at Access Help for the property you want to affect. You will find
the available settings, and usually an example.
Look at Access Help for the Format property. Read the section on
Yes/No fields.
---------------------------
Good luck with your project!
- Hammer |
Clarification of Answer by
hammer-ga
on
31 Dec 2002 15:22 PST
By the way, try to avoid using the word "Google" in your questions,
unless they actually pertain to Google or Google Answers. It causes
your question to be locked for a while, until Google Answers gets a
chance to see if your question is one that they want to answer
themselves, rather than leaving it up to a Researcher.
- Hammer
|
Clarification of Answer by
hammer-ga
on
31 Dec 2002 15:38 PST
cheaptrinket,
I've just noticed that I reversed the condition you requested. I have
the Name in Red when Booked is NOT checked. I apologize for the mixup.
Let me know if you need for me to fix this in the examples.
- Hammer
|
Request for Answer Clarification by
cheaptrinkets-ga
on
31 Dec 2002 15:46 PST
can you implement both examples and post them to the web site. thanks.
|
Request for Answer Clarification by
cheaptrinkets-ga
on
31 Dec 2002 15:53 PST
i mean that the first example is interesting but not practical, the
reason we need that is that for some weeks there will be 30 records or
more. we need to tell someone on the phone within a few moments if a
client is available. therefore we need it to be in continuous display.
please post an example using this.
thank you very much.
walter
|
Clarification of Answer by
hammer-ga
on
31 Dec 2002 15:56 PST
Both examples are already implemented in the database that is waiting
for your download. My answer includes instructions for where to find
the example of each implementation.
|
Clarification of Answer by
hammer-ga
on
31 Dec 2002 15:59 PST
I know that you needed an example that worked on continuous forms, and
this is included in the database, which is waiting for you to
download. I also built an example of regular conditional formatting in
response to your request to understand the concept in general.
- Hammer
|
Clarification of Answer by
hammer-ga
on
31 Dec 2002 16:25 PST
cheaptrinkets,
I've found another way to do this that you might like better. There's
a new feature in Access that allows for conditional formatting in
continuous forms. I'm not sure how stable it is, but you can give it a
try. It involves making selections in a dialog box, so I can't just do
it for you and post it, or you won't be able to tell what I did.
Here's the step-by-step to do this yourself:
1. Open the subform Holds Viewing Active - Date in Design View.
2. Select the Name control.
3. From the Format menu, choose Conditional Formatting.
4. Under Condition 1, select Expression Is.
5. In the blank box next to Expression Is type:
[Booked]=True
6. Select the font color and style you want to use.
7. Click OK.
8. Save your Form.
Give that technique a try, and see if you like it!
- Hammer
|
Request for Answer Clarification by
cheaptrinkets-ga
on
01 Jan 2003 12:41 PST
I appreciate your assistance. The point of the form is this. We get a
phone call. "Which of your clients are available?" It would be good to
see at a glance who is booked (therefore not available). Having all
records that are not booked as red do not make this easier. If you
could make this information appear when the condition is true that
would be appreciated.
Secondly, I don't understand why you can try your final solution? You
have all of the parameters.
Thanks again.
|
Clarification of Answer by
hammer-ga
on
02 Jan 2003 04:44 PST
"If you could make this information appear when the condition is true
that
would be appreciated."
I changed the condition on all the examples so they appear when
Booked=True. You can download the database at:
http://www.hammerdata.com/Google/
"Secondly, I don't understand why you can try your final solution?
You
have all of the parameters."
I can try it, and I did. I gave you the instructions so that you could
do it yourself. You mention in your question that you wanted to know
how to dot hese things for yourself, so that you could apply the
technique to other fields as the need arose. I also added it as an
example to the currently posted database.
- Hammer
|