Shutdown/Reboot Windows

D

David W

I have made a db with Access. This is set up with a front and backend. What
I am wanting to do is to come up with a way through a separate db(which I
can figure out) to warn users of a reboot or shutdown.

Is there a way through VBA to shutdown/reboot windows legitimately.

Thanks
David
 
W

Wayne Morgan

There are API functions you can use to shutdown or reboot Windows. Also,
Windows will send a shutdown notification to each open application and you
can have your application cancel the shutdown.

Another option without using API calls, will depend on your version of
Windows. An NT computer (this includes Win2k and WinXP) will have a shutdown
command available. You could use Shell to execute that.

Example:
shell "command.com /c shutdown -m \\ComputerName -s -t 60"
 
D

David W

Never have dealt with shell.
How do you use it and where do you put it?

What I have thought of and I am in the middle of it right now, is to put
either "Shutdown" or Reboot" in a field in the users table that is
associated with the front-end, then with a timer event, refresh the
front-end, it will have that data then. Now I have a form within the
front-end that will popup when triggered when it sees the text above warning
the other users of what is about to happen to the backend(this is strictly
to control data corruption).

Anyhow, thought I would let you know what I am doing aliitle bit.

Can you use the shell(is it called a command) from within VB?

I am wanting to keep a small form in its own little db. open for about 7
minutes. This should allow everybody to finish what they need. If I can use
it in VB, I will put it at the end of the code in the ontimer event when my
forms closes to either shutdown or reboot.

I Appericate your response, I did find this morning a very elaborit way to
shutdown windows, it was in the windows tips & faqs.

Is there a shell command for reboot also?

Thanks
David
 
W

Wayne Morgan

Yes, Shell is a VB command. The sample command line I gave is how it is
used.
 
D

David W

shell "command.com /c shutdown -m \\ComputerName -s -t 60"

can you tell me what the parameters mean so that I can understand it a
little better.
 
D

Douglas J Steele

In essence, it's the equivalent of opening a command box (that's what
"command.com /c" is supposed to mimic) and typing

shutdown -m \\ComputerName -s -t 60

into that command box.

Look up help on the shutdown command for details of what the arguments being
passed are.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top