I have been trying to get a Microsoft Access for to 'escape' from the main Access window so that I can hide the Access window and just show the form on the desktop so that it can be placed alongside other applications easily.
At first I found some code samples that use Access' own Form.PopUp property but this cannot be set at runtime, only when in design view. Although this seems to achieve what I'm trying to do, there are two drawbacks:
Switching between design view and normal view requires 'closing' the window in between - I'd rather keep it open to preserve the current state especially as it's used for creating new records which are necessarily unsaved.
I want to open other forms from the main one which also doesn't seem to work well with this approach unless they too are set as 'pop-up'. But this is a hassle as these would also need to be put into design view, etc and I'm not sure if it would be easy to switch between the two pop-up windows.
I then found an API function called SetParent that seemed to do what I need. I used the following commands (VBA syntax):
SetParent ShowForm.hWnd
ShowWindow hWndAccessApp, SW_HIDE
ShowWindow ShowForm.hWnd, SW_SHOWNORMAL
But I ran into two problems (probably related:
The window seemed to be rather unresponsive (I couldn't type into it, for example and clicking the buttons didn't seem to work either).
When I did ALT+TAB, I got a BSOD:
BugCheck 1000008E, {c0000005, 9e3573f5, 88d9da10, 0} Probably caused by : win32k.sys ( win32k!xxxNextWindow+3a6 ) at win32k!EngLineTo+1a641
Is there any other way to do this so that I can have a form without the access window that is able to call and display other access forms outside of the main access window?
I have noticed in the SetParent API Documentation that there are a couple of other things that need to be done - changing the UI state and changing the window style but I can't find the right methods to do them. Would doing this fix the BSOD and non-responsiveness problem?
Thanks for any ideas!