How to stay form on top (1 Viewer)

smtazulislam

Member
Local time
Today, 06:32
Joined
Mar 27, 2020
Messages
806
Hello,
I using MS ACCESS 2016 PRO. I have a dashboard. Its have Menubar to click open form. But some form have to need open another form.
Any ( Dashboard Form + A Form + B Form)
* A Form > I put MODEL = No (for stay Top)

Problem is when I open B Form then A Form will be under the Dashboard. I dont see it. And should be close the Dashboard.

I want Dashboard > Top at A Form > I want when I click dashboard then A Form stay top of Dashboard.
A Form > To at B Form.
three form see at onetime

Picture have attached
Any help will appreciate.
 

Attachments

  • Untitled.png
    Untitled.png
    170.8 KB · Views: 192

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 11:32
Joined
May 7, 2009
Messages
19,231
google api that will "stay on top" your form/window.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Yesterday, 22:32
Joined
Feb 28, 2001
Messages
27,140
No... "Google" is a verb in this case.


What you want to do is to move something to the front of the other forms on the desktop. The article here shows one way. If you know what to ask for, you can search the web using your favorite browser, which does not have to be google. You are looking for "BringToFront" which can be applied to forms among other VBA-related objects.
 

smtazulislam

Member
Local time
Today, 06:32
Joined
Mar 27, 2020
Messages
806
No... "Google" is a verb in this case.


What you want to do is to move something to the front of the other forms on the desktop. The article here shows one way. If you know what to ask for, you can search the web using your favorite browser, which does not have to be google. You are looking for "BringToFront" which can be applied to forms among other VBA-related objects.
Thank you so much Sir.
I am sorry for late reply. I will try it then give feedback as soon.
 

smtazulislam

Member
Local time
Today, 06:32
Joined
Mar 27, 2020
Messages
806
Code:
Private Sub Form_Current()

If IsOpen("frmDashboard") Then
    Me.Controls("frmEmployeeEdit").InSelection = True
    DoCmd.RunCommand acCmdBringToFront
Else
    Me.Controls("frmdashboard").InSelection = True
    DoCmd.RunCommand acCmdSendToBack

End If
End Sub

Runtime error '2465'
Not working....
 

Gasman

Enthusiastic Amateur
Local time
Today, 04:32
Joined
Sep 21, 2011
Messages
14,231
Seems self explanatory?, though not related to the code you posted? :unsure:
 

smtazulislam

Member
Local time
Today, 06:32
Joined
Mar 27, 2020
Messages
806
So something is wrong with that form as Access cannot find a field named in the error message?
I think, this code for inside the form an object, Because, I seem Me.Controls " ".InSelection
But not sure...
 

Gasman

Enthusiastic Amateur
Local time
Today, 04:32
Joined
Sep 21, 2011
Messages
14,231
Well look to see where that field is mentioned in that form?. Likely misspelled as it appears to be LfrmDepartmentLookup
 

smtazulislam

Member
Local time
Today, 06:32
Joined
Mar 27, 2020
Messages
806
Well look to see where that field is mentioned in that form?. Likely misspelled as it appears to be LfrmDepartmentLookup
Its also a form name what I try it second time. Because, frmEmployeeEdit isnot word.
 

Gasman

Enthusiastic Amateur
Local time
Today, 04:32
Joined
Sep 21, 2011
Messages
14,231
I get an error saying that the form must be in design mode for this to work?

Code:
Me.Controls("txtSearchMain").InSelection = True
 

Gasman

Enthusiastic Amateur
Local time
Today, 04:32
Joined
Sep 21, 2011
Messages
14,231
It is a control on a form.
Why are you even doing this?
Just check if the form is open/loaded and not in design mode then bring to front or back.

Code:
Function IsLoaded(ByVal strFormName As String) As Boolean
' Returns True if the specified form is open in Form view or Datasheet view.
' Use form name according to Access, not VBA.
' Only works for Access
    Dim oAccessObject As AccessObject

    Set oAccessObject = CurrentProject.AllForms(strFormName)
    If oAccessObject.IsLoaded Then
        If oAccessObject.CurrentView <> acCurViewDesign Then
            IsLoaded = True
        End If
    End If

End Function
 

smtazulislam

Member
Local time
Today, 06:32
Joined
Mar 27, 2020
Messages
806
It is a control on a form.
Why are you even doing this?
Just check if the form is open/loaded and not in design mode then bring to front or back.

Code:
Function IsLoaded(ByVal strFormName As String) As Boolean
' Returns True if the specified form is open in Form view or Datasheet view.
' Use form name according to Access, not VBA.
' Only works for Access
    Dim oAccessObject As AccessObject

    Set oAccessObject = CurrentProject.AllForms(strFormName)
    If oAccessObject.IsLoaded Then
        If oAccessObject.CurrentView <> acCurViewDesign Then
            IsLoaded = True
        End If
    End If

End Function
Its also not work. I donot know where I put wrong spelling or mistake.
I preper to sending my db without code. you can try it new
 

Gasman

Enthusiastic Amateur
Local time
Today, 04:32
Joined
Sep 21, 2011
Messages
14,231
No, won't work for me as I only have 2007 (12) and 14 is the minimum to get it working. I am sure we have been down this path before. :unsure:
I'll have to step back and let someone with a more current version have a look at it. Sorry. :(
 

Users who are viewing this thread

Top Bottom