Yes, we suggest using the form's hWnd as the index of the collection.
You can then loop through the Forms collection, and find the instance that
has the hWnd, and then Forms(i).SetFocus
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users -
http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_canada.com> wrote in message
news:YI2dnRP8CrwnBDrfRVn-3g@rogers.com...[color=blue]
> Take a look at what Allen Browne has at
>
http://www.allenbrowne.com/ser-35.html
>
> --
> Doug Steele, Microsoft Access MVP
>
http://I.Am/DougSteele
> (no e-mails, please!)
>
>
> "David W. Fenton" <dXXXfenton@bway.net.invalid> wrote in message
> news:Xns966FCED3D6066dfentonbwaynetinvali@24.168.1 28.74...[color=green]
>> I'm blanking out on this one.
>>
>> In an old applicaiton, I am implementing a new feature to allow the
>> user to open multiple instances of a main form. I've got that
>> working, using the code for this from the Access Developers Handbook
>> (which I've used successfully many times in the past).
>>
>> Now, the problem I'm having is that when I close the second
>> instance, the focus is not necessarily going back to the original
>> form.
>>
>> DoCmd.SelectObject can't work because it requires a form name and
>> all forms have the same name, of course.
>>
>> Is there a way to select a form by index? I do know the index in the
>> form's collection, because I'm storing it in a global variable for
>> the original form.
>>
>> Any ideas?
>>
>> --
>> David W. Fenton
http://www.bway.net/~dfenton
>> dfenton at bway dot net
http://www.bway.net/~dfassoc[/color][/color]