Solved

Access2003 - Workable area based on screen resolution

Posted on 2006-11-16
4
248 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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now