?
Solved

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

Posted on 2013-11-04
3
Medium Priority
?
316 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 49

Accepted Solution

by:
Dale Fye earned 750 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 58

Assisted Solution

by:Jim Dettman (Microsoft MVP/ EE MVE)
Jim Dettman (Microsoft MVP/ EE MVE) earned 750 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

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

807 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