Calling the Immediate Window

D

David Mulholland

I handle dozens of DBs for various offices in my organization. The biggest
hurdle I face is when I have to update data for these back-ends, someone
somewhere invariably has the DB open. I have a Master DB that I use to
automate all the updating I have to do and have incorporated the
"WhoIsInTheDatabaseLockFile" procedure to find the Machine Names of these
users (none of these DBs use user-level security - I inherited them as is). I
then have some code to open a cmd window and run the psloggedon.exe from
SysInternals (now part of Microsoft) to get the actual username of the person
I need to yell at.

All of this works great except the time and hassle it takes to open the
Module, hit Control-G to get the Immediate Window, run the procedure, copy
the machinename, go back to the form with the pslogged.exe code and running
that to get the actual username.

Is there a way to make this easier? Is it possible to call the procedure
from the main form and have it spit the results back into a memo(?) field on
that main form?

I've really only just begum playing with the Immediate window and don't know
what I can and can't do with it.

Any thoughts or suggestions would be appreciated. Thanks.
 
R

Ron2006

What we have done here to get around that problem to a great extent:

1) Create a separate mdb with one table called "ShutDownTable"
2) modified each related application to have a link to this table.
3) Have the startup process query that table to see if the value is
"ShutDown" or whatever value you decide to indicated don't run, and
have it open a form that says that the tables are temporarily not
available and have a timer event on that form to Application.quit
after some amount of time.
4) Create a timer event on some form that is ALWAYS open, even if it
has to be hidden, that also does the same thing and opens the same for
as number 3 above.
5) Set the timer time for 4 above no more than about 3 minutes or so.

Given the above, we can usually get everyone out and keep new people
out in about 5 minutes so.

The trick is to REMEMBER to reset the shutdown value after you are
finished doing what you have to do.

Ron
 
D

David Mulholland

Thanks for the quick reply, Ron. I do currently have a shutdown routine
embedded in all the front-ends that I'm about to deploy. I guess I wasm't
exactly clear on my question.

Is there a way to call a routine (that you normally run in the Immediate
Window) from a form and have the results (from that Immediate Window) show up
on that form (in a memo field or something like that)?

The reason is sometimes some yahoo in some section somewhere will create a
separate/stand-alone DB linked to various back-ends. When I have to update
these back-ends, since they're using a DB I didn't create it won't have that
shutdown procedure in it. I want to be able to easily find out who they are
so I can make that nasty phone call.

I guess I'm just looking for an easier way to work with the Immediate Window
from my Master DB Main Form.
 
R

Ron2006

Definitely a harder problem and I have not seen an easier solution.

I got around that problem with one application here, by changing the
way the tables were updated. Instead of replacing the mdb, I ran a
query to empty the tables involved and then append new records.

Of course this does NOT solve the bloat problem and is not a good long
term solution but could work on some.

Ron
 
T

Tony Toews [MVP]

David Mulholland said:
Is there a way to call a routine (that you normally run in the Immediate
Window) from a form and have the results (from that Immediate Window) show up
on that form (in a memo field or something like that)?

Sure. In behind a command button on a form run that same routine that
you'd put in the immediate window. I'm not sure how you see the
results from your WhoIsInTheDatabaseLockFile function/subroutine. If
it's a debug.print you could change the code to put the text in an
unbound control on a form.

You could have another command button that shells a batch file which
runs psloggedon.exe and pauses.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
D

David Mulholland

Thanks for the response. I do have a shell calling the psloggedon.exe and
that works great. I'll try your suggestion and see what I come up with.
 

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

Similar Threads


Top