Link to home
Start Free TrialLog in
Avatar of MikeDTE
MikeDTEFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Reselect form

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
Avatar of mbizup
mbizup
Flag of Kazakhstan image

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?
Avatar of MikeDTE

ASKER

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.
Avatar of MikeDTE

ASKER

Going out now - back in about 4 hours.
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)


ASKER CERTIFIED SOLUTION
Avatar of mbizup
mbizup
Flag of Kazakhstan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of MikeDTE

ASKER

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!
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.
Avatar of MikeDTE

ASKER

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.