Solved

How to VBA detect an Access Form is currently opened in Network environment?

Posted on 2013-11-04
3
307 Views
Last Modified: 2013-11-04
Dear Expert,

Assuming Form A is a MainSwitchBoard, can anyone shed some lights how to detect if Form A is currently being opened in a Network environment with VBA codes?

The reason for such detection is my solution need to Append some data after the last person on the network quit the database.

Thanks in advance
0
Comment
Question by:kaysoo
3 Comments
 
LVL 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 250 total points
ID: 39621265
not sure I understand completely, but you might add a table to your database, and record every time FormA is loaded and who loaded it.  There really is no other way to determine whether another user has opened a form or not.

Several of my applications track this for all forms, so that I can track the frequency with which each form is used.  It is easy enough to do, create a table with fields for FormName, UserId, dtOpened, dtClosed.

Then use the form Open event to write a new record to the table with FormName, UserID, and dtOpened.  Then use the form Close event to update dtClosed for that User/Form combination.  The down side of this is that if the user terminates the program abnormally, you may end up with a NULL in the dtClosed field.
0
 
LVL 57

Assisted Solution

by:Jim Dettman (Microsoft MVP/ EE MVE)
Jim Dettman (Microsoft MVP/ EE MVE) earned 250 total points
ID: 39621348
There's no way to do that directly.  You have to set some type of flag as Dale suggested and build that into the application.

As a suggestion, you can use the code here:

http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_5328-Resource-locking-in-your-applications.html

 to do that type of thing.   You just need one table that all applications can see.

 Just ast the article suggests setting a lock for when a user enters/exits a database, you could do that for forms and reports as well, as Dale suggested.

Jim.
0
 

Author Closing Comment

by:kaysoo
ID: 39623308
Thanks everyone, I never thought of that, appreciate the suggestions.
0

Featured Post

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now