Solved

Reselect form

Posted on 2011-09-30
8
326 Views
Last Modified: 2012-05-12
I have a Form in Access from which a Command Button opens a child form.  When the child form opens the focus moves - all OK so far.  When I close the child form the parent form is not in focus - i.e the title bar is greyed out.

I have tried using Forms!fName!fieldName.SetFocus but that doesn't work

How can I reselect teh Parent form please
0
Comment
Question by:MikeDTE
  • 4
  • 4
8 Comments
 
LVL 61

Expert Comment

by:mbizup
ID: 36891167
That *should* happen automatically, unless something else is hogging the focus.

Do you have any other popup or modal forms or reports open?

What actually is in focus when Form 2 closes?
0
 

Author Comment

by:MikeDTE
ID: 36891182
Both parent and child forms are in fact Popups.  Form A calls Form B, Form B Calls Form C.  Form C is close and sets focus back to Form A rather than Form B.
0
 

Author Comment

by:MikeDTE
ID: 36891185
Going out now - back in about 4 hours.
0
 
LVL 61

Expert Comment

by:mbizup
ID: 36891202
Okay -

Make sure that form A  is not Popup/modal (If form B is a popup/modal form, that should ensure that it gets the focus when form C closes)


0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
LVL 61

Accepted Solution

by:
mbizup earned 125 total points
ID: 36891221
Also, just a thought - I usually avoid the popup and modal properties altogether, and use acDialog to lock focus on certain forms as needed.

So from form A (which is neither popup or modal):

Docmd.OpenForm "FormB",,,,,acdialog

and from Form B

Docmd.OpenForm "FormC",,,,,acdialog



0
 

Author Closing Comment

by:MikeDTE
ID: 36893946
Thanks once again mbizup - you helped me earlier this month as well (remember the reference to Virginia Tech?)
I didn't like the Pop-up windows really and the solution use acdialog is very effective at achieveing the same thing.  Plus I can anchor the child form into the middle of the parent form to make it noticable!
0
 
LVL 61

Expert Comment

by:mbizup
ID: 36894076
Hi Mike,

Glad to help out again!

Another neat (and occasionally useful) thing about acDialog is that it actually suspends the code execution in the calling routine temporarily while the popup form is open, and then resumes the code at the next line when you close the popup form.  That allows you to from a main form open a popup that does stuff that the main form is dependent on, and then resume the code in the main form to process whatever information it was waiting for when the user closes the popup form.

The modal and popup properties lock the focus, but don't suspend the code like this.
0
 

Author Comment

by:MikeDTE
ID: 36894116
Thanks for this extra info - very useful.  My experience is VB and not VBA and the syntax is very difference althogh the structure is the same.

I am having problems with opeing tables that are not in the Record Sorce of the form - watch out for a post on this.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

910 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now