Results 1 to 2 of 2
  1. #1
    Monterey_Manzer is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2012
    Posts
    164

    Using variables and form window properties to set locations of controls

    Hi All,



    Due to the number of forms/reports that my current Access dbase generates, and ease with which some users are confused, I use the Tabbed Documents view rather than the overlapping windows view to present these forms and reports. This is quite effective in keeping my users focused on a single report or form at any one time but it does have some negative effects on the placements of my controls. This is generally only a problem with the forms and that is why I am posting it here. My problem is that my control appear, depending on the window size each user alots for the Access, to be either off the screen to the right or smashed against the left margin.

    Here is my question: Is it possible in VBA to get the window size of each form and set the locations of the controls based on that information? I have been doing a lot of coding in Matlab lately and I use a similar approach to center the titles and text labels of my graphical outputs. Is there a property of the forms or simply in Access that will provide me with the length and width of the window so I can write some code to center my controls in the On Open Event?

    Thanks!
    Ryan

  2. #2
    Beetle is offline Unrelatable
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    Camp Swampy (Denver, CO)
    Posts
    207
    Is it possible in VBA to get the window size of each form and set the locations of the controls based on that information?
    Yes, but this is no small undertaking. There is no built in functionality for this and it involves a LOT of code. Not only does the form have to be resized, but all of the controls have to proportionally resized and repositioned as well based on the screen res, plus sections, sub forms, on and on. You can find a third party tool for this at Peter's Software. If using a third party tool is not an option for you there are a couple of older Access books that included examples of the code necessary for this. One was Access 2002 Desktop Developers Handbook and I think some of the editions of the Access Cookbook may have had sample code as well, so you might see if you can find any copies of those books.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Forms Controls, Methods and Properties
    By cfwoodbury in forum Access
    Replies: 5
    Last Post: 10-09-2012, 09:35 AM
  2. Replies: 2
    Last Post: 08-28-2012, 03:43 PM
  3. Replies: 1
    Last Post: 07-13-2012, 08:50 AM
  4. Replies: 3
    Last Post: 04-23-2012, 12:06 AM
  5. properties window disappeared
    By arcademonkey in forum Access
    Replies: 4
    Last Post: 07-19-2011, 09:15 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums