I am utilizing the Rx for colored selected record bar found here:
"Highlight Current Record in an Access Continuous Form"
With a few minor modifications, such as placing into shared code as much of the code as possible and using a pointer to the
form to understand which form is calling the shared code.
Anyway, I wanted to force a group of lookup / picklist forms to the Title field of the form. I force the "move to" via this
'Force the the UI to the title field control
I have placed that code just after the finding of the correct record... Oh... that bit was not part of the Rx, rather
something I added on my own to make the UI more intuitive. So, if the field has a current value, I re-locate that current
value when the pick list form opens. That way people are less likely to accidentally change data in the application. (Edit
record, top record is selected, and push the Select button = data got changed)
So at the point that the SetFocus is called, the correct record does have focus, and the SetFocus does successfully default
the field to the Title field. Just it does not have the green background color that it is suppose to.
Now, something that was in the Rx I use for colored selected record... in the Rx's ChangeBackColour event, I have put a
Debug.Print to see what color is being set. I always see the same number, including the time that the SetFocus forces the UI
to the Title field.
'Generic API used for the colored row selection capability
Sub uiutils_GridSetSelectedRowBackgrond(ByRef MePointer As Form)
On Error Resume Next
Debug.Print "Reference: " & Screen.ActiveControl.BackColor
Debug.Print "Before: " & MePointer.fldCurrentID.BackColor
'Set the current control's background to that of the fldCurrentID
Screen.ActiveControl.BackColor = MePointer.fldCurrentID.BackColor
Debug.Print "After: " & MePointer.fldCurrentID.BackColor
And I see:
in the immediate window. Which it should as that hidden control has the green background hard coded into it.
I can click the left arrow, and immediately the Title field background turns green properly. Right arrow back to the Title
field, green color remains as it should.
Suggestions as to why I can not successfully force the default field to Title without loosing the Green color?
Oh... I pocked just a bit deeper... the color number is NOT always the same... when I arrow to the ID field and back, the
Reference number changes...
Evidently I can not find out the color of the actual control being set... THAT is what is always the same.
Perhaps could "Screen.ActiveControl.BackColor" be referring to the field on the Edit Part form which is white?
Anyway, any suggestions as to why forcing the default field would not retain the Green color? TIA!