473,388 Members | 1,188 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Bring Form To Front

Alireza355
I have an access database, with the default switchboard opening and maximizing on startup.

I have put an ON-LOAD event, that opens a pop-up, modal form called frmLogin to ask for username.

When the application starts, the switchboard opens, maximises, and the frmLogin form pops up.

But sometimes, I don't know why, the pop-up form is not on the top.

I tried different methods:

frmLogin.setfocus

or

on-timer of switchboard (every 2 seconds) I tried using this:

if [forms]![frmLogin].isloaded = true then

frmLogin.setfocus

end if

but it doesn't seem to be working.

Is there another more POWERFUL!!!!!! way of bringing the frmLogin to front?
Mar 10 '09 #1
5 37107
DonRayner
489 Expert 256MB
Popup forms will always be on top of other forms unless the other form is also a popup.

When a forms modal property is set to true, you can't leave the focus of that form untill it's closed. That means you can't set focus to it because it already has the focus.

At times something is delaying the opening of your switchboard form and it is being rendered after your popup form. since they both have their popup properties set to true, the last one opened will be on top. Now since your popup form is also a modal it still has the focus even though you cant see it. Therefor trying to setfocus to it through vba will have no effect.

Some possible solutions would be.

1. If there is a lot of code in the On Open event for your switchboard, you could try moving the call for your popup to the end of the "On Open" event, just before the sub exits.

2. Change the popup's modal property to no so that the setfocus would work.

3. Change the switchboards popup property to no so that it wouldn't sit on top of your popup.

4. You could move the call for your popup from the On Load event to the On Timer event.

Don
Mar 10 '09 #2
Thanx a lot Don.

Will give it a try.

Best Regards,
Alireza355
Mar 10 '09 #3
DonRayner
489 Expert 256MB
You're quite welcome
Mar 10 '09 #4
missinglinq
3,532 Expert 2GB
Don's suggestion # 3 really makes the mosts sense of the four! Why would you have a Switchboard form set to Popup? Most developers, if they're going to leave a Switchboard form loaded, want it under subsequently opening forms, not on top, which it will be unless all others forms have Popup set to True as well.

Of course, if I were doing it, I'd have the login form load first when the database opened, then load the Switchboard from that form.

Linq ;0)>
Mar 10 '09 #5
I also had this problem. It seems that the On Load event opens the pop up form before it has completed loading its own form. I solved the problem by putting a counter into the On Load event to give the form more time to load itself before opening the pop up form. The event code looks like this:

Private Sub Form_Load()

Dim i As Integer

Do Until i = 10000
i = i + 1
Loop

DoCmd.OpenForm "dlgSelectCamper"

End Sub
Jul 14 '10 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Charles A. Lackman | last post by:
Hello, I have created an application that searches to see if a process is running and if it is it maximizes it's window. i.e. For Each AProcess In AProcesses If...
2
by: Tyson | last post by:
I have got this little piece of code that fires on exit of a text box. It run's my query perfectly based of my form input. But I don't know how to bring result in my query back to a text box on my...
0
by: ACaunter | last post by:
HI there.. I have a dropdown menu for my asp.net website (not a combo box with the down arrow).. its for Home, Compant, ... , Contact Us... and then when the mouse goes over it, the sub menus are...
9
by: DraguVaso | last post by:
Hi, I want my application to bring another application to the Front. I thought best way to do this was by the Process-model: Dim c As Process = Process.GetCurrentProcess() Dim p As Process...
2
by: muymalestado | last post by:
In A2000 is it certain that one cannot perfoem 'Bring to front' using code. Is is also the case that 'Visible = True or =False' is different and separate from a control's zorder and thus that if...
5
by: Iain Bishop | last post by:
I have a simple form with 4 command buttons and 1 label. The label is sometimes visible and sometimes not. When it is visible I want it to be in front of the buttons. I've tried bringing the label...
1
by: Marcel Brekelmans | last post by:
Hello, I have an application with a notifyIcon. When my application's main form is hidden by some other window I would like to bring it in front by single-clicking the NotifyIcon. However, I...
1
by: anandansv | last post by:
I create a menu using javescrip in asp.net2.0 in this the menu shows behind the controls in the form if i open a form and if it has any dropdown control in that form then the menu goes behind...
2
by: =?Utf-8?B?R2lkaQ==?= | last post by:
Hi, I asked here yesterday about bringing a form to front with hotkey while using different application then mine (meaning, when i'm using outlook, and pressing ALT+T it will bring a form from...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.