I have spent days combing forums like this one and anything else I could find, for comprehensible code to move between two separate Access databases open in separate windows, when the name of the other window is known. Spent a lot of time staring crossed eyed at api, hwnd, and other scripting stuff. None of which I could decipher well enough to get it to work.
In the end, I seem to have found a simple, elegant solution by cobbling together bits of simple vba code. I present it here for others who may need it.
In database one:
Private Sub Button_Click()
Dim objAccess As Object
Set objAccess = GetObject("C:\DirectoryPath\Filename.accdb")
objAccess.DoCmd.OpenForm "ThisForm"
DoCmd.RunCommand acCmdAppMinimize
End Sub
In Database two, in the On Open of "ThisForm":
Private Sub Form_Open(Cancel As Integer)
Forms!ThisForm.SetFocus
Forms!ThisForm!AnyControl.SetFocus
End Sub
Of course the last bit can then be followed by any code you want, to do what needs doing in the second database. In my case the code in the first database is part of a bigger chunk which pushes data from database one into database two (via three append queries), and I then proceed to create a new record in a sub form of "ThisForm" based on those new records.
I now also have a tool I can use to allow my end users to move back and forth between these two related, but separate databases, either of which they may need to consult or update at any given moment, without having to go to the windows task bar. And also very important, I don't end up with extra instances of my files open.
Victory is mine!