Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exit all users out of DB with Timer Event...

Status
Not open for further replies.

MeisoT

Technical User
Apr 25, 2004
43
US
I would like to have Access automatically close all databases at 11:59pm each night if the user has forgotten to exit before they left for the day. I know that I have to use the timer event. Can anyone tell me what value I need to use that equals 11:59pm and the specific code that will accomplish this.

The version is Access 2000.

Thanks.
 
I'm using the timer event of a form, to run a function every night around four o'clock.
Every fifteen minutes, the timer event checks, if the current hour is 4 using something like datepart("h",now()) ...
set the timer interval of your form to 900000 (equals to 15 minutes)
Code:
private sub form_timer()
dim h as integer
h = datepart("h",now())
if h = 0 then
application.quit
end if
end sub

You can granulate this more downwards to the minute, but remember, that you have to run the on timer event of the form more often to do this, and that's not recommended.


HTH,
fly

[blue]Typos, that don't affect the functionality of code, will not be corrected.[/blue]

Martin Serra Jr.
[blue]Shared Database_Systems and _Applications across all Business_Areas[/blue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top