Set focus on form

Posted on 2011-10-27
Medium Priority
Last Modified: 2012-06-21
I have a form that opens by clicking on a command button on a modal form.  When the new form opens, it is hidden behind the previously opened form.  I want to keep the previously opened form visible but want the new form to appear in front of it.  How do I accomplish this?  I have tried to set its focus on open, but that doesn't work.  Any ideas experts?
Question by:Harry Batt
  • 4
  • 2
LVL 75
ID: 37042518
Set the Modal and Popup properties of the Form you are opening to Yes.

LVL 75
ID: 37042528
OR ... you can just set the PopUp property of the form you are opening to Yes.  It will then initially open on Top of the other form, but can go behind if you click onto the original Form.

So, you have a couple of options ...

LVL 75

Accepted Solution

DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 2000 total points
ID: 37042537
Also ... just in case, post the code for the Command button that is opening the form.

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

by:Harry Batt
ID: 37042656

Thanks for your two options.  Here is the code I am using for opening the second form.  What I didn't mention is that there is another parent form that always remains open.  So in fact there are three forms open.  What I have done is change the second form's property so that modal=false and visible=false.  This is changed back to true when the third form is closed.

I haven't tried your solutions yet but will in a few minutes.
Private Sub cmdAddSolicitor_Click()
On Error GoTo cmdAddSolicitor_Click_Err

    DoCmd.OpenForm "frmSolicitorAdd-Gifts", acNormal, "", "", , acNormal
    Me.Modal = False
    Me.Visible = False
    Exit Sub

    MsgBox Error$
    Resume cmdAddSolicitor_Click_Exit

End Sub

Open in new window


Author Comment

by:Harry Batt
ID: 37042683
Setting the Pop Up property on the third form to yes solves the problem. Thanks again DatabaseMX.    
LVL 75
ID: 37042693
You are welcome ...


Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question