Solved

Access2003 - Workable area based on screen resolution

Posted on 2006-11-16
4
255 Views
Last Modified: 2008-01-09
Hi All,

I have an Access2003 database that changes the form / sub-form size based on the screen resolution.  However, the problem is that I am using fixed values based on the screen size.  I really want to be able to stretch the forms based on the usable area for each PC.  By this I mean the actual usable height from the top of the screen to the Taskbar.  If I can figure this out, I can program the size to fit - regardless of the situation.   The width shouldn't really be an issue as most of my clients have the task bar at the bottom, but some have this locked, unlocked, or hidden when not in use.

Most of my clients are using Windows XP, but some are still running 2000.

Any suggestions would be really appreciated.
0
Comment
Question by:Andy Brown
  • 2
4 Comments
 
LVL 84
ID: 17954774
Do you mean you want your forms to fill the entire Access area? You can do this by issuing a DoCmd.Maximize in the form's Load or Open event.

Do you mean you want to resize your forms based on the screen resolution? Access forms expose a Resize event where you can do this, but it's a fairly huge task. You might be better off purchasing a 3rd party resizer and using that. Most 3rd part resizers provide font resizing, etc:

http://www.peterssoftware.com/ss.htm
http://www.jamiessoftware.tk/resizeform/rf_jump.html (this one's free)
http://www.fmsinc.com (includes one as part of their Total Access Compnents package)

Finally, the Developer's handbook provides code which you can use to build your own:
http://www.amazon.com/exec/obidos/I...8064361-7403703
0
 
LVL 84
ID: 17954781
0
 
LVL 39

Accepted Solution

by:
stevbe earned 500 total points
ID: 17954811
If you only want to change the width and height of the forms (and not mess with font size) it is fairly easy to do main form / subform sizing. The key is to use the .Insideheight and .InsideWidth to get the runtime width and height of your main form.

in the main form open event I maximize the entire application...

Private Sub Form_Open(Cancel As Integer)
    DoCmd.RunCommand acCmdAppMaximize
End Sub

then in the main form resize I fix up the subform (and in this example I have a Notes field that is Memo)
'-------------------------------------------------------------------------------
Private Sub Form_Resize()
'-------------------------------------------------------------------------------
'   enable custom error handling
    On Error GoTo ErrHandler
'-------------------------------------------------------------------------------
   
    'size the notes field to fill the screen
    Me.txtBudgetNote.Width = Me.InsideWidth _
                             - Me.txtBudgetNote.Left _
                             - 30
   
    'size the discipline subform to fill the screen
    Me.childDiscipline.Width = Me.InsideWidth _
                               - Me.childDiscipline.Left _
                               - 30
    Me.childDiscipline.Height = Me.InsideHeight _
                                - Me.Section(acHeader).Height _
                                - Me.Section(acFooter).Height _
                                - Me.childDiscipline.Top _
                                - 30
   
'-------------------------------------------------------------------------------
ExitHandler:
    Exit Sub
'-------------------------------------------------------------------------------
ErrHandler:
    Select Case Err.Number
        Case 2100   'ignore, user made form too small, Access wil handle this
        Case Else
            LogError ErrLogMod:="frmBudget", _
                     ErrLogProc:="Form_Resize", _
                     ErrLogNo:=Err.Number, _
                     ErrLogDesc:=Err.Description, _
                     ErrLogDisp:=True
    End Select
    Resume ExitHandler
'-------------------------------------------------------------------------------
End Sub
'-------------------------------------------------------------------------------

0
 

Author Comment

by:Andy Brown
ID: 17955287
That's perfect - I wish I'd seen that command before.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question