Solved

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

Posted on 2013-11-04
3
311 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
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…

738 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