UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Detect Windows Shutdown, Loggout Or Lock, Access 2013    
 
   
jcharrow
post Dec 2 2017, 07:01 PM
Post#1



Posts: 3
Joined: 2-December 17



In my Access 2013 database how can I detect if Windows (7-10) is shutting down, or if the user is logging out of windows or is being automatically locked?
I would like to trap this event to make sure that the Access application is exited before WIndows is shutdown/locked or the user is locked.
Thanks
Go to the top of the page
 
theDBguy
post Dec 2 2017, 07:31 PM
Post#2


Access Wiki and Forums Moderator
Posts: 71,202
Joined: 19-June 07
From: SunnySandyEggo


Hi,

Welcome to UtterAccess!
welcome2UA.gif

Not sure about the sleep or locked part, but when Windows shuts down, I think it sends a message to all open applications, Access will have a chance to shut down on its own first.

What is your main concern?

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 
jcharrow
post Dec 2 2017, 08:06 PM
Post#3



Posts: 3
Joined: 2-December 17



My biggest issue is that when a user is locked the application continues to run, and the db can't be opened for exclusive use.
Go to the top of the page
 
theDBguy
post Dec 2 2017, 09:28 PM
Post#4


Access Wiki and Forums Moderator
Posts: 71,202
Joined: 19-June 07
From: SunnySandyEggo


Sounds like you’re not using a split configuration, which is highly recommended. Is this correct? Do you have a separate front end and back end files? If so, are you trying to open the back end file in exclusive mode? If so, for what purpose?

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 
jcharrow
post Dec 2 2017, 11:09 PM
Post#5



Posts: 3
Joined: 2-December 17



It is a split configuration, and as I update the front end I need to be able to make changes to the back end - e.g. add a new field to a table, add a report etc.
This post has been edited by jcharrow: Dec 2 2017, 11:11 PM
Go to the top of the page
 
GroverParkGeorge
post Dec 3 2017, 07:48 AM
Post#6


UA Admin
Posts: 31,195
Joined: 20-June 02
From: Newcastle, WA


If I understand then, your problem is not really getting a notification to the user when they close their copy of the accdb, but that YOU want to get exclusive control of the back end accdb for updates. That's not possible if a user has left their PC on with their copy of the front end accdb on their computer still open. That locks the back end.

The resolution, therefore, would be that you should try to do maintenance only outside regular work hours for your users, so that you don't interrupt their work. And that's a whole different problem.

First, I'd let your users know in advance when you plan to do maintenance and tell them to close their copy of the accdb at that time. If they don't do that, you have to have a way to force close it for them, and that's a bit more involved, and not without potential risk.

For starters, how many users are we talking about? 3, 30, 300? How hard would it be, in other words, to address them directly with an email or IM?

I have seen solutions in which you, the developer, can implement code in your application which allows you to reach out and close everyone's copy of the FE when you have to do that. I'll take a look in our code archives and samples. Or perhaps someone will already have a link handy.

Here's one such implementation. Perhaps you can adapt it to your needs.
This post has been edited by GroverParkGeorge: Dec 3 2017, 08:23 AM
Reason for edit: Added link to sample code

--------------------
Go to the top of the page
 
theDBguy
post Dec 3 2017, 11:35 AM
Post#7


Access Wiki and Forums Moderator
Posts: 71,202
Joined: 19-June 07
From: SunnySandyEggo


Hi,

I was going to say the same thing. Let us know if the demo George suggested helped. Good luck!

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    12th December 2017 - 07:06 AM