Solved

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

Posted on 2013-11-04
3
309 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

809 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