How to stay form on top (1 Viewer)

smtazulislam

Member
Local time
Today, 13:56
Joined
Mar 27, 2020
Messages
806
v 2003 -2007
 

Attachments

  • FormStayOnTop_v2002.mdb
    512 KB · Views: 105

Gasman

Enthusiastic Amateur
Local time
Today, 11:56
Joined
Sep 21, 2011
Messages
14,255
So give the me the EXACT steps of the problem as this stupid dashboard takes the whole screen and so I cannot show what I see with a picture. :devilish:
 

Gasman

Enthusiastic Amateur
Local time
Today, 11:56
Joined
Sep 21, 2011
Messages
14,255
OK, this is what I have so far.
I cannot open that other form on the dashboard as the source for it is not present.??? and even if I could the this form is modal?
1606575374508.png
 

Gasman

Enthusiastic Amateur
Local time
Today, 11:56
Joined
Sep 21, 2011
Messages
14,255
And I have clicked it ?
Let's be a little more verbose with this please, or I will just stop. :(

One liners do not help me to help you??
 

smtazulislam

Member
Local time
Today, 13:56
Joined
Mar 27, 2020
Messages
806
You open dashboard. and also open frmEmployeeEdit.
Now I want to stay two form as well and need to open another form to click from dashboard button. and this form should be stay on the top of the frmemployeeEdit form.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 05:56
Joined
Feb 28, 2001
Messages
27,156
I may have misled you. My apologies. BringToFront applies to controls but not, apparently to forms. That is why you get the comment about having to be in design mode.

Open the form that you want "in front" in acDialog mode, which makes it a "modal" form. IF you do this, you stop all background activities within Access because the world stops for dialogs. Note, however, that if you open another form from the dialog form, if that new form is not ALSO in dialog mode, it will be behind the dialog form.

If you have multiple non-dialog forms, what SHOULD happen is that if you set focus on any control on the desired form, that SHOULD "bubble up" to the top. If any of the forms are in dialog mode, though, dialog mode overrides the effect of set focus.

Perhaps you could use Forms("formname").ControlName.SetFocus to force the named form to the front after you open it. Or if you want a given form to always go in front when you first open it, you can Me.ControlName.SetFocus from the form's _Load event. If you use the .SetFocus method to bring forms forward, remember that the form in front is the one with the chronologically most recent .SetFocus method.
 

Gasman

Enthusiastic Amateur
Local time
Today, 11:56
Joined
Sep 21, 2011
Messages
14,255
Forcing setfocus is not happening for me Doc?
 

Gasman

Enthusiastic Amateur
Local time
Today, 11:56
Joined
Sep 21, 2011
Messages
14,255
O/P has the forms set as Popup, and that does not allow the bubble up to the front.?
Removing that allows forms to the front.

O/P needs to define better approach?
I'm not that aufait with all the forms functionality, so I will bow out.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 05:56
Joined
Feb 28, 2001
Messages
27,156
Gasman, I recall having issues with this before so I don't claim any superior knowledge on form behavior. I misremembered the BRINGTOFRONT because I had forgotten it was a CONTROL action, not a form action.

I suggested that the forms all have to be "equal" for the .SETFOCUS to work right because a pop-up form isn't equal to a normal form in display priority. The same problem would be true for a MODAL (Dialog) form.

The ONLY other way I could think of to do it would be to find a Win32 API call, use the form's .HWND property, and manipulate the form that way. If the forms are not all acNormal then even the API might not do it. I would have to search for the right API call because it has been literally a decade since I had to do it.
 

Gasman

Enthusiastic Amateur
Local time
Today, 11:56
Joined
Sep 21, 2011
Messages
14,255
@The_Doc_Man
The O/P had the Employee form as Popup AND Modal, so why they thought they could put another form on top, I have no idea?
That is about as much as I know for Forms. :(

The DB was even set to Tabbed Documents?
 

Users who are viewing this thread

Top Bottom