Solved

Access2003 - Workable area based on screen resolution

Posted on 2006-11-16
4
254 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

789 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