A family of Microsoft relational database management systems designed for ease of use.
You're right On_Load a much better choice!
Can you post a screen shot? Might help to identify.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Access 2007, Windows 7. My job management database utilizes modal, pop-up forms, most which are called from other modal, pop-up forms. In order to customize the look of the application, I set the form backgrounds in a generic subroutine that utilizes a global color constant. I want to change the background color on a form when is "loses the focus" to another form. Example:
Form A (modal, pop-up) has the focus, green background. Click on control which launches Form B (modal, pop-up). At this point, I want to change the color on Form A to, say, gray so that it doesn't visually blend with the green background of Form B.
My problem is I can't seem to find the event that allows me to change the color on Form A. I thought it would be the "Lost Focus" event but, evidently, that is not triggered when I click the control. Also tried the "Deactivate" event with no luck. Is the modal, pop-up settings causing a problem or is that a red-herring?
Thanks for any assistance.
A family of Microsoft relational database management systems designed for ease of use.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
You're right On_Load a much better choice!
Can you post a screen shot? Might help to identify.
Makes perfect sense.
Event routine won't run OnOpen but works at OnLoad (think due to not knowing form name to pass to subroutine) which is still probably better than OnCurrent (there's probably some nuances in the order of events which I still need to understand).
My Dividing Lines is set to "No". Looked to see if there are some margins settings but don't see at form level. It's odd that the lines don't show on the first color setting but do on the second. In design mode, the color of the form is set to Office default so I would have thought that I would see the lines on the first instance of loading Form A. Not a big deal - I'm pretty obsessed about wanting to understand what's going on!
Thanks again for your help.
Bob
First, I would put it in the On_Open event of Form B as it only needs to change Form A once.
Yes, that is correct, no events on Form A are triggered so trying to *make it do something* and there is nothing to tell it do something will never happen. Gee, I hope that made sense!
That line you are seeing is constant unless you set Dividing Lines to *No*.
Thanks Gina. That's does work but opens up several other issues for me. Right now, I'm trying to accomplish this without hard coding form names. I pass the form name using (Me.Name) as a parameter to the subroutine (sets the background) that runs on the OnCurrent event - looks like I'll also need the name of the previous form(s). Hmmmm.
So, since I'm not technically closing Form A, none of the events are triggered on that form?
One last item - when I reset the color on Form A (upon loading of Form B), I notice the slightest of lines at the intersection between the Form Header/Detail and the Detail/Form Footer that appears to remain the original background color. Weird. My code is:
Public Sub SetBackGround(MyForm As String)
Forms(MyForm).Section(0).BackColor = MyBGColor ' detail section
Forms(MyForm).Section(1).BackColor = MyBGColor ' header section
Forms(MyForm).Section(2).BackColor = MyBGColor ' footer section
End Sub
Bob
Not sure you can do with Form A. I think you have to tell Form B to do it as it opens and then Form B to change back upon closing.