UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Positioning The Access Window On Startup, Access 2010    
 
   
merlenicholson
post Apr 29 2015, 10:14 PM
Post#1



Posts: 520
Joined: 23-November 11
From: Tampa, Florida, USA - UTC -5:00


This is a demo project that has very simple methods and properties to position the overall Access window - when the application is opened - in one of two positions - 1) Centered on the primary monitor or 2) Positioned exactly where the application was at the time of closing the last session. The size of the Access application is controllable as well. It is implemented as a class module, and has an additional required module. In the startup form or a global module, the AppPlace class is declared, and it takes about five more lines of code in the startup form, and it's done.

Caution: It makes extensive use of the Windows 32-bit API. It has not been converted to run in 64-bit Access. In my best guess, though the conversion would be trivial.

Another feature has a very complete informational panel that tells you about the size of your application, user forms, the overall screen size and the size and position of the primary monitor.
Attached File  AppPlace.JPG ( 83.47K )Number of downloads: 87

The zip file has two identical versions - AppPlace2003.mdb and AppPlace2010.accdb. It has one form for demo purposes. Looking at the form in the code window you'll see the minimum required calls to the class. In the class module, all the properties and methods are listed as comments, along with some narrative, mostly about how the four Access parameters are saved.

One caution - the last position of the Access window must be saved ay application close, so your application should be exited through a form so that the Form_Close event is fired. If you have multiple exits that one line of code can be put in all of the forms as long as you have declared the class globally. I have not tested it in Access 2007 or Access 2013, but my expectations are that it will work perfectly without modification.

These modules are pretty old, originating over fifteen years ago probably in Visual Basic 5; it has some code that while it works perfectly, isn't what I would do today. For instance there's a FindLast routine that is easily replaced by the built-in function InstrRev, introduced in VB6. But it's been working continuously in my applications since.
Attached File  AppPlace.zip ( 130.18K )Number of downloads: 184
Go to the top of the page
 
dg_moore
post Jun 12 2018, 05:31 PM
Post#2



Posts: 261
Joined: 22-April 11



Don't know if anybody currently here understands how this works, but my understanding is pretty sketchy. How would I use this to set the application window to a specified L, T, W, H on open of the app? Exactly where would I plug in the default values? I have a LoadForms() procedure called by an Autoexec macro - I could launch the AppPlace process from this procedure, but what AppPlace procedure would I call?
Go to the top of the page
 
merlenicholson
post Jun 14 2018, 01:49 PM
Post#3



Posts: 520
Joined: 23-November 11
From: Tampa, Florida, USA - UTC -5:00


I'd be happy to get this running for you if I can. I just tested the app using Windows 10 and Access 2010. This has been time tested in a hundred or more apps of my own, and I see downloaded 150+ times with no complaints, so I'm considering this pretty successful.

Can you run the demo app OK? THat's key of course. when you open the test app the form auto starts in the center and the button press will display as in the picture. You should then import the module and class module into your app and then add code to the declaration section of your startup form.

If you look at the declarations section of the form frmMain, you'll see the code
CODE
Public AP As New AppPlace
. Thats the minimum required to activate the module and declare the variable AP for further calls. You have included the one module and one class module, correct? Look below that code for suggestions on how to do further calls.

Do all that and give me the results. Or implement it in a simple app for your own demo purposes and send it to me.

Thanks
Merle

--------------------
Merle Nicholson
Ninety percent of all mental errors are in your head. - Yogi Berra -
Go to the top of the page
 
dg_moore
post Jun 14 2018, 08:40 PM
Post#4



Posts: 261
Joined: 22-April 11



Merle, the demo app seems to run fine in Access 2016. I'll try your suggestions and get back to you.

Thanks
Dave
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    18th September 2018 - 03:03 PM