Solved

Reselect form

Posted on 2011-09-30
8
323 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
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…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

744 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

10 Experts available now in Live!

Get 1:1 Help Now