Solved

Reselect form

Posted on 2011-09-30
8
331 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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Dot leaders between two labels in report 10 33
SSRS Deployment problem 5 65
Access/Visual Basic Question 3 24
Access form for login using active directory 6 21
When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
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…

861 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