You are correct that the text box needs to be locked and
disabled so that it can not receive the focus no matter
what.
The thing we forgot is that the Enabled property is one of
the ones that is set by Conditional Formatting, so just
change the CF setting for Enabled to make the CF example
look grayed out (the text box's Locked property set to Yes
will make it look normal on the form).
Ted wrote:
in doing some further testing i found myself absentmindedly clicking in the
'body' of the continuous form's 'current' record display (as opposed to the
left vertical bar) in an effort....to my chagrin i found that while the color
changed as i'd expected, there was nothing visible --- it was as if the
transparent 'dummy' control had gone opaque on me and wasn't allowing the
data to shine through. the problem disappears or never arrives when you click
on the left vertical bar where the pointer's displayed but i thought i'd
outsmart this devilish detail by setting some properties, like locked to
'yes' and enabled to 'no' and tabstop to 'no' but all to no apparent avail

is this the achilees' heel in all this? can this be circumvented? i'd
like to 'failsafe' the app'n so users don't need to worry about where their
cursor's sitting so long as it's more or less 'on' the current record.
:
Err on the side of angels?? What's wrong with a little
experimentation on a copy of your database?
Whatever! For each PK field, add a hidden text box to the
form's header along with the corresponding line line of code
in the Current event.
Then the Conditional Formatting expression would be:
[pk1] = [txtKey1] And [pk2] = [txtKey2] And . . .
Ted wrote:
if i can, can we try to expand on this for the "general case" where the
table's pk field is actually comprised not of one but a couple.
i think we went through this once before when i was interested in having
this capability applied to current/active records viewed via the 'datasheet'
modality, so i have a hunch i think i know what the approach'd be. but i like
to err 'on the side of the angels'.
:
Ahhh, so it's the current record on a continuous form. In
that case, add a hidden text box named txtCurrentKey to the
form's header section and add a line of code to the form's
Current event:
Me.txtCurrentKey = Me!pkfield 'table's primary key field
Next, create a text box (without an attached label) and size
it to the fill the entire detail section. Set its BackColor
property to the standard color code (14613758). Then use
the Format - Send To Back menu item to place it behind all
the other controls. Make at least your label controls have
a transparent BackStyle. Now you can use Conditional
Formatting (Format menu) to set the BackColor of this big
text box:
Expression Is: [pkfield] = [txtCurrentKey]
Ted wrote:
at the risk of offending the lexicographers among us, to me the 'active
record' would be instance/view of the continous form's when the pointer sits
upon it; the information appearing via the continuous form's display on the
crt which can be immediately accessed by the user.
:
Sorry, Ted, but I have no idea what you mean by "when it's
the active record".
It's simple enough to change a section's BackColor property:
Me.Section(0).BackColor = 4227327
but there must be something more to your question than just
that.
Ted wrote:
i think i needed to fine tune my objective to read i wanted to change the
background color of the 'details' section alone, leaving the other sections
color be.
:
my a2k form is actually a 'child' sub-form (but that probably doesn't
matter). what i want is to enable the form to change color when it is showing
the 'active' record.
when i checked on it, the background color of the details section of the
sub-form was 14613758 which is the same as the rest of the form and main
form. let's say we want to change it to 4227327 when it's the active record.
the name of the actual sub-form is "Adverse Events (child)".