Solved

How to Maximise an Access form when MS Access application restores

Posted on 2014-02-08
4
916 Views
Last Modified: 2014-02-08
I am using the Access Window Manipulation code from http://access.mvps.org/access/api/api0019.htm to minimise an access window which contains a modular pop up form which maximise on open.

I have a button on the form to minimise the application of its onclick even :-
fSetAccessWindow(SW_SHOWMINIMIZED)

Everything works fine until I try to restore the application by click the access icon on the taskbar. The application restores but the form does not maximise.

I have experiment with an onclick event on the form to maximise it when click and that works but I'd prefer an event that triggers automatically when the aplication restores.

So the question is how do I programatically maximise an access form when the application restores.
0
Comment
Question by:Sheils
  • 2
  • 2
4 Comments
 
LVL 27

Expert Comment

by:MacroShadow
ID: 39844560
Put DoCmd.Maximize after the call to fSetAccessWindow(SW_SHOWMAXIMIZED)
0
 
LVL 16

Author Comment

by:Sheils
ID: 39844564
Tried that, it does not change anything.
0
 
LVL 27

Accepted Solution

by:
MacroShadow earned 500 total points
ID: 39844607
Ok I see the problem.

Copy this to the form:
Private Sub Form_Resize()
    Me.TimerInterval = 1
End Sub

Private Sub Form_Timer()
    DoCmd.Maximize
    Me.TimerInterval = Empty
End Sub

Open in new window

0
 
LVL 16

Author Closing Comment

by:Sheils
ID: 39844696
That works like a charm. However, I made a little modification because I have an unbounded text box on the form that uses the ontimer event to display the time. This may be handy for viewers who want to this code but continue using the on timer event for other things. The modified code is as follows:

Private Sub Form_Resize()

'Set timer to 1 millisecong and the maximise boolean to true
Me.TimerInterval = 1
booMaximise = True

End Sub

Private Sub Form_Timer()

Me.txtClock = Now() 'Reset the clock textbox every second

If booMaximise = True Then 'Only run this code when booMaximise is true. True is set in the on Resize event

booMaximise = False 'Reset the booMaximise to false so that the clock will still run
DoCmd.Maximize 'Maximise the form
Me.TimerInterval = 1000 'Reset the time interval to 1 second

End If

End Sub
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

776 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