Search code examples
vbams-accessms-access-2016

How to resize an access form to fit the screen


So I've recently upgraded from Access 2003 to Access 2016 and of course, I hate having to deal with the obnoxious white background that can not be changed in 2016. Maximizing forms/reports is not an option for us as we oftentimes will be using multiple forms/reports at any given time and need to be able to view and change between them to do our job.

I've come up with what I think is a pretty smart solution, I created a background form that is empty except that it has a dark gray background to make it easier on your eyes. When you open a new form or report (On Open Event), it then places that form on top of a stack so that you have a hierarchy of open forms and reports.

Should you click on a form or report that isn't on top (On Activate Event), then it gets moved back to the top of the stack. Then should you accidentally click on the background form, instead of covering up everything you've been working on, it goes through the stack, starting at the bottom and setting focus to each form or report in order. Here's how I do it for those of you interested:

Private Sub Form_GotFocus()
  Dim db As DAO.Database
  Dim rst As DAO.Recordset
  Set db = CurrentDb
  Set rst = db.OpenRecordset("SELECT ID, FormName, FrmRpt FROM FormStack ORDER BY ID", dbOpenSnapshot)
  If rst.EOF Then
    DoCmd.OpenForm "frmMenu"
  Else
    While Not rst.EOF
      If rst.Fields("FrmRpt") = "Form" Then
        Forms(rst.Fields("FormName")).SetFocus
      Else
        DoCmd.SelectObject acReport, rst.Fields("FormName")
      End If
      rst.MoveNext
    Wend
  End If
  rst.Close
  Set rst = Nothing
End Sub

This is all working perfectly, I just need to make sure I add the code to any new forms or reports that I create.

So here is my dilemma, this background form needs to be big enough to fill the screen of whoever is using it, otherwise, you would see white around the edges. Since everyone has different monitors I decided to make the form extremely large (21"x13") so that it would fill the screen of anyone who is using it. I have Auto Center, Auto Resize, and Fit To Screen all set to yes.

I have No border, record selectors, navigation buttons, diving lines, scroll bars, control boxes, close buttons, or min-max buttons, and it also is not moveable. The Detail section can grow and can shrink. So now everything is working, except since this form is bigger than anyone's Access window, there are now scroll bars on the Access window itself so that you can move around to see the whole background form in all of its drab, dark gray glory.

It would be great if it could be fit to fill the Access window perfectly so that these scroll bars won't appear and confuse users.

Does anyone know how to solve this problem?


Solution

  • Well this doesn't resize a form to fit the screen, but Access now has a Dark Gray theme which gives me a dark background and solves my problem.