Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / March 2005

Tip: Looking for answers? Try searching our database.

onMinimize - Event availible ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Nieurig - 15 Mar 2005 08:17 GMT
Hello folks,
i need to disable a running timer if the Access-Mainform
was minimized.
How can I solve this?

Thanks in advance for any help.
Niels
JaRa - 15 Mar 2005 10:11 GMT
I think this can help you :

The Deactivate event occurs when the form or report loses the focus to a
Table, Query, Form, Report, Macro, or Module window, or to the Database
window.

The OnDeactivate value will be one of the following, depending on the
selection chosen in the Choose Builder window (accessed by clicking the Build
button next to the On Deactivate box in the form or report's Properties
window):

- Raoul

> Hello folks,
> i need to disable a running timer if the Access-Mainform
[quoted text clipped - 3 lines]
> Thanks in advance for any help.
> Niels
nieurig - 15 Mar 2005 10:57 GMT
Hi Raoul,
thanks for your comment.

>The Deactivate event occurs when the form or report loses the focus to a
>Table, Query, Form, Report, Macro, or Module window, or to the Database
>window.
Well, but I have set the database window to hidden and it
don't occurs when the Access-Mainform was iconified.

>The OnDeactivate value will be one of the following, depending on the
>selection chosen in the Choose Builder window (accessed by clicking the Build
>button next to the On Deactivate box in the form or report's Properties
>window)
I can't translate (understand) this.
From which point i can get a VALUE ?
I can RUN code by deactivating the form (actually i use
this to save the current record of the form) but is there
any information about which object get the focus availible?

Niels
Dirk Goldgar - 17 Mar 2005 22:08 GMT
> Hello folks,
> i need to disable a running timer if the Access-Mainform
[quoted text clipped - 3 lines]
> Thanks in advance for any help.
> Niels

The form's Resize event will fire whenever the size of the form changes,
including when it is minimized.  So all you have to do is check, in that
event, to see if the form is minimized.  You can call the "IsIconic"
Windows API function to determine this.  So you might hjave code like
this in your form's module.

'----- start of code -----
Option Compare Database
Option Explicit

Const conInterval = 1000   ' every second
'*** SET YOUR DESIRED TIME INTERVAL HERE

Private Declare Function apiIsIconic _
       Lib "user32" Alias "IsIconic" (ByVal hwnd As Long) As Long

Private Sub Form_Resize()

   If apiIsIconic(Me.hwnd) Then
       Me.TimerInterval = 0
   Else
       If Me.TimerInterval = 0 Then
           Me.TimerInterval = conInterval
       End If
   End If

End Sub

Private Sub Form_Timer()

   ' your timer code here ...

End Sub

'----- end of code -----

Signature

Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.