Solved

Reselect form

Posted on 2011-09-30
8
335 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 
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
 
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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

717 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