Re-size form to fit to screen on form load (1 Viewer)

flaghippo

Registered User.
Local time
Yesterday, 21:01
Joined
Jan 22, 2012
Messages
19
Hi all
I have 10 users with various screen resolutions all using Access 2010.
Is there a neat bit of code that will check the resolution on load and re-size.
I have tried DoCmd.Maximize with no luck.
Any help would be great.
Thanks
Flaghippo
 

flaghippo

Registered User.
Local time
Yesterday, 21:01
Joined
Jan 22, 2012
Messages
19
Thanks for your reply
 

jamesmor

Registered User.
Local time
Yesterday, 23:01
Joined
Sep 8, 2004
Messages
126
You need a paid-for tool for this:

http://www.peterssoftware.com/ss.htm

not really, depending on your proficientcy with VBA.

You could check the resolution of the monitor, then resize the form based on monitor size.

Here's an example of getting the monitor resolution I found using Google.

and

here's an example of setting your form height/width using vba.

You'd have to detect resolution, then change your form size. The drawback to this is that you'd have to have pre-defined form sizes unless you could figure out some percentage or something to change the size by.

Lastly you could put a message in if they are viewing in a resolution you don't support.
 

smig

Registered User.
Local time
Today, 07:01
Joined
Nov 25, 2009
Messages
2,209
not only ou will have to size the form AND controls you will also have to move them and resize font size.
it does require some work but you can go over all controls and resize and move them. it will work well for most controls
 

Rank Am

Registered User.
Local time
Today, 12:01
Joined
Apr 30, 2005
Messages
68
If you don't want to be tied to licensing third party products for use in your applications I would definitely check out the Access 2002 Desktop Developers Handbook. It has the neat bits of code you are looking for included on a cd
All the code and documentation for implementing class modules that handle all moving, maximising, scaling forms, controls, fonts etc. I have built classes from this 7 years ago that I still use in access 2007 applications today. The book is still in print and also contains loads of other useful reference information and code that i still use definitely worth the $30
 

jamesmor

Registered User.
Local time
Yesterday, 23:01
Joined
Sep 8, 2004
Messages
126
Umm, there is a reason why Peter's Software Shrinker/Sizer works the way it does.

I was just merely pointing out that you don't need third party software.

Where I work, third party software is out of the question. Yes, they'd rather have me reinvent the wheel than pay $40 for some software so I don't have to.

Also, don't know if you meant to come across as condescending, but you pulled it off brilliantly.
 

vbaInet

AWF VIP
Local time
Today, 05:01
Joined
Jan 22, 2010
Messages
26,374
I was just merely pointing out that you don't need third party software.

Where I work, third party software is out of the question. Yes, they'd rather have me reinvent the wheel than pay $40 for some software so I don't have to.

Also, don't know if you meant to come across as condescending, but you pulled it off brilliantly.
It's not about how well versed you are in VBA, it's about whether you have the time and know exactly what you're faced with.

Getting a form to resize to fit the current resolution isn't a matter of using an API and a method to resize the form. What about scaling the controls? What about re-positioning the controls? What about moving the sections?.. and many more. All of these have been put into consideration, tried and tested in Peter's kit.

Bob was simply pointing out that it's not as small a job as you made it to look. Perhaps the book from Rank Am will provide some good pointers.
 

Rank Am

Registered User.
Local time
Today, 12:01
Joined
Apr 30, 2005
Messages
68
I don't think bob sounded condescending at all, but I do know where your coming from with the corporate paranoia over third party software. Our Corporate management are quite happy for me to get developers in on short term contracts as some sort of "Systems Maintenance Consultant" as long as its budgeted no matter what the cost, even if it's not budgeted I only need one level higher authority to raid the emergency operations budget for mission critical apps to get staff. However third party activeX controls, licensed stuff etc, not allowed full stop unless they are willing to handover the source code and ownership - also counts as a capital acquisition so has to go through procurement dept. Even if your 100hrs was 10K as opposed to 2.5K I wouldn't even attempt to procure a few hundred dollar app in our org. The time and hassle involved with procurement, + our auditors go over all capital purchases like hawks and the bean counters hatred of capital purchases make it a bad idea. Even though it's dumb and makes no sense to me it just seems to be the way it is. Good news for consultants though, I have five year call off + retainer contracts with 3 "System Maintenance Consultants"
 

Davo

New member
Local time
Today, 14:01
Joined
Aug 9, 2012
Messages
2
I like simple!

Public frmHeight As Double
Public frmWidth As Double

Private Sub Form_Load()

DoCmd.Maximize
frmWidth = Me.InsideWidth
frmHeight = Me.InsideHeight
DoCmd.MoveSize 0, 0, frmWidth, frmHeight

End Sub


This works and looks good too.:cool:
 

Davo

New member
Local time
Today, 14:01
Joined
Aug 9, 2012
Messages
2
woops
Try this..
Public frmHeight As Double
Public frmWidth As Double

Private Sub Form_Load()

DoCmd.Maximize
frmWidth = Me.InsideWidth
frmHeight = Me.InsideHeight
DoCmd.Restore
DoCmd.MoveSize 0, 0, frmWidth, frmHeight

End Sub
 

smig

Registered User.
Local time
Today, 07:01
Joined
Nov 25, 2009
Messages
2,209
@Davo - This will only resize the form, not taking care for the controls ....
 

Jan Downar

New member
Local time
Today, 05:01
Joined
Dec 15, 2015
Messages
1
If you don't want to be tied to licensing third party products for use in your applications I would definitely check out the Access 2002 Desktop Developers Handbook. It has the neat bits of code you are looking for included on a cd
All the code and documentation for implementing class modules that handle all moving, maximising, scaling forms, controls, fonts etc. I have built classes from this 7 years ago that I still use in access 2007 applications today. The book is still in print and also contains loads of other useful reference information and code that i still use definitely worth the $30

I also use this resizing tool many years for MS Access 2002. The only problem is that screen resolution bigger than 1920x1046 is not able handle it at all. My application stops responding. Have you experienced such problem ?
 

PatAccess

Registered User.
Local time
Today, 00:01
Joined
May 24, 2017
Messages
284
Hello,
I was just reading this Thread and was wondering if @flaghippo ever received a working resolution for this issue?

Thank you
 

Users who are viewing this thread

Top Bottom