Solved DoCmd.Restore - but on the Access shell window, not just a form

Isaac

Lifelong Learner
Local time
, 19:43
Joined
Mar 14, 2017
Messages
11,158
Hi. I'm utilizing the precise instructions here in order to handle the desire to (sort of) hide the Access shell and make it look just like a Form by itself. It's not theoretically perfect, but it gets me as close as I care or need to. It appears to be just a form - as long as I press Restore on the outer window. (If I don't press Restore, it opens up maximized - and also looks like the Form is the same size as the Access shell, so still hides the shell - but looks silly, as the content of the form is only a much smaller portion).

So for my visual pleasure, when I open the db, I always click Restore first thing, and everything looks perfect, however, I'd like to automate this.
DoCmd.Restore has no effect. Any ideas?
How it looks when it first opens - sometimes.jpg

How I want it to look.jpg
 
We have discussed this before.
The approach you are using adjusts the Access interface to fit the form size. That's OK if
it gets me as close as I care or need to.
However, it will take very little additional work to use the API code as explained in my example app so that the Access interface is completely hidden.
In the end, its your choice ...
 
Yes, indeed we have, and your contributions and insight are always appreciated.

I've been giving this some more thought since I posted. As I've mentioned in the past, I keep myself under very strict rules when it comes to using code that I don't fully and intimately understand (although in this case I might have made an exception because the goal is not mission-critical).

It's not that I have anything 'against' your code, it's just that it falls into that category where if something happened, I probably wouldn't know how to fix it myself, (because of my own ignorance and lack of expertise).

I did some more thinking about my scenario and how controlled it is - people access this virtual desktop for no reason other than to run this database, and decided to use Sendkeys (alt+spacebar+r). I still think what I always say about Sendkeys, but there are rare exceptions for anything...this is one occasion where I'm just going to use it (seems to work great) and leave it at that. In fact this is the only place I am or have (in the past 5 years) used it at all and hopefully will keep it at that :)

Thanks gentlemen for your advices. If I continue to have more need for the additional functionality that your code provides, I shall revisit. Thanks
 
As I said, its your choice.
But perhaps it wouldn't take long to study the code so you understand it.
Its really not that difficult

EDIT:
OTOH try running this command when your app/form loads:
Code:
DoCmd.RunCommand acCmdAppRestore
Does that do what you want?
 
Last edited:
EDIT:
OTOH try running this command when your app/form loads:
Code:
DoCmd.RunCommand acCmdAppRestore
Does that do what you want?

That worked perfectly! Just what I was looking for. I commented out my shameful Sendkeys lines :) and put that in its place, worked like a charm.

Thanks @isladogs !!
 
Oh, I believe you can... :cool:

Isaac, if I understand what you are trying to do, I did something similar with an app I developed. I did not like hiding the Access window - it just didn't seem like a good thing to do. Access can be finicky on its own and I have learned that when you "fight" Access, Access usually wins!

I used MoveSize to customize the window to the size I wanted my form and then used the other settings in the link you provided to achieve the desired result. Maybe I should have asked on this forum like you did I would have learned about acCmdAppRestore (as well as OTOH and CTWYM...)

I think we should consider a thread for CID's lingo....
 

Users who are viewing this thread

Back
Top Bottom