Marshall,
I'm trying to do the following: (it's all in the last paragraph).
I have a series of lists of addresses on a form that I want to transfer to
another form when the user clicks on an address. Eventually creating a new
correct list.
The target address list must ultimately be in the correct order; the
challenge is for the user to select the addresses in that order.
The way I want the form to work is to have two forms, the form on the left
will be the Target Form, and the form on the right is the Selector Form. Both
Forms are continuous forms because each list of addresses are different
lengths.
The twist is that the Selector form addresses will be in a random order, and
by the user clicking on a selection, that address will be transferred to the
Target Form list. Eventually all available selections will be chosen, making
a complete list.
This all works fine now, so each time the user selects a candidate address
for the target form, and assuming it is correct, the selected address 'greys
out' leaving an ever diminishing list until there are no more addresses in
the Selector Form. That is what the 'If...then backcolour' statements are
doing. If the CF was capable of displaying 'system colours' I wouldn't need
the If... statements. However, It all works very elegently now, with the
'If...' statements; but significantly without the the CF code.
I hope this all makes sense.
Marshall Barton said:
This entire concept is based on getting CF to use the right
color. You will not get anywhere without using CF.
Using those If statements is destroying what we are trying
to do with CF so get rid of them. I have no idea what you
are trying to accomplish by using those If statements.
Unless you are changing your mind about what you want to do,
I am still assuming that you want the special color in
Waypoint_Selector when it is Null, so set WayPoint
Conditional Formatting to:
IsNull([Waypoint_Selector])
and use this one line of code in the Open event procedure:
Me.Waypoint_Selector.FormatConditions(0).BackColor=-2147483633
It's not clear to me when you want the Direction_Selector
control (text box?) to use the special color, but it seems
like you want to set this control's CF Expression to:
IsNull([Direction_Selector])
and add this line of code:
Me.Direction_Selector.FormatConditions(0).BackColor=-2147483633
to the Open event in the form that contains the
Direction_Selector control.
--
Marsh
MVP [MS Access]
With reference to my last reply, another question arises; which is 'Will
your code only work if the Conditional Format' is set to something, in this
case 'IsNull([Waypoint_Selector])' allows the code to work, but if I remove
the conditional formatting, the code process fails. Is this a big, or have i
not realised that you need Conditional Formatting turned on for the code to
work?, if so,does this segment from you code 'FormatConditions(0).' relate to
it?
:
It worked; though I have a slight problem in that there are 2 different
control boxes relating to the same record, but only when the second control
code is executed do both controls turn to the required grey colour. These are
the 2 code segments, have you any idea what is going wrong?.
If (Forms.Runs.[frm_Run_Test].Form.[Direction_Combo] =
Forms.Runs.[frm_Run_Test].Form.[Run_Direction]) Then
Me.Direction_Selector.FormatConditions(0).BackColor = -2147483633
'This Changes the background for the Direction Selection Control
End If
If (Forms.Runs.[frm_Run_Test].Form.[Waypoint_Combo] =
Forms.Runs.[frm_Run_Test].Form.[Run_waypoint]) Then
Me.Waypoint_Selector.FormatConditions(0).BackColor = -2147483633
'This Changes the background for the Waypoint Selection Control
End If
:
Well, you did misunderstand, but I didn't provide more than
the bare essentials either. That line of code will set the
BackColor of the first conditional format for the textbox.
This is needed because the CF color picker does not provide
the color you want. The Open event is just a convenient
place to manipulate the CF properties.
Use Copy/Paste from the section's BackColor property
(probably a negative number) to replace "colornum" in the
code. The Negative color codes tell Access to get the color
from Windows' Display Property Settings. Search Help for
System Colors for a list of these color codes. Positive
color numbers are easiest to create using the RGB function.
efandango wrote:
I wanted to use the background colour for a 'Conditional Formatting' box,
based on a condition, not on a form open situation. I hope I have interpreted
your answer correctly.
This is the code I have in my 'Conditonal Formatting' feature:
My Expression for the Conditional box at the moment is:
IsNull([Waypoint_Selector])
So how would I use that in a:
If my [controlname] IsNull then make it this background Colour (MS Access
Lightest Grey)?
or have i completely missunderstood your response, apologies if that it the
case.
:
efandango wrote:
Is there an alternative to the ‘Conditional Formatting’ facility, the problem
is that I want to use the standard light grey background colour for my text
box (effectively making it invisible. But that particular shade is not
available in the colour picker on this feature. So how would I express it
with a numerical equivalent?
My Expression for the Conditional box at the moment is:
IsNull([Waypoint_Selector])
The code in the form"s Open event would be like:
Me.textbox.FormatConditions(0).BackColor = colornum
Where colornum is the value in the text box section's
BackColor property