Results 1 to 5 of 5
  1. #1
    Amine is offline Novice
    Windows 10 Access 2007
    Join Date
    Nov 2021
    Posts
    8

    MS access multi users : Determine which form is open

    Hello,
    I'm sharing a ms access project over network with multiple users.
    I want to know which form is already opened by the other users in their computer.
    for that, i have a form called "dashboard" containing two buttons , each button open a different form (docmd ...) the first button open the form "Form1", the second button open the form "Form2".
    The idea is that buttons in "Dashboard" changes their colors (caption.forecolor) when they opened by a user.
    I used the code :

    Code:
     Private Sub FormsCtl()
    If CurrentProject.AllForms("Form1").IsLoaded = True Then
    Me.Commande0.ForeColor = RGB(255, 0, 0)
    Else:
    Me.Commande0.ForeColor = RGB(51, 204, 51)
    End If
    If CurrentProject.AllForms("Form2").IsLoaded = True Then
    Me.Commande1.ForeColor = RGB(255, 0, 0)
    Else:
    Me.Commande1.ForeColor = RGB(51, 204, 51)
    End If
    End Sub
    Code:
    Private Sub Form_Open(Cancel As Integer)
    FormsCtl
    End Sub
    
    
    Private Sub Form_Timer()
    FormsCtl
    End Sub



    When I open a form (Form1 or Form2) in my computer , I get the code working perfectly (Buttons colors changed) .
    But when an other user open the same forms in his own computer, Colors of buttons don't change in my computer.
    Attached Files Attached Files

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    you should NOT share a db frontend with many users.
    each user should get their own copy of the FE.

  3. #3
    Amine is offline Novice
    Windows 10 Access 2007
    Join Date
    Nov 2021
    Posts
    8
    thanks for your fast reply, but before distribuating frontend copies, i should make a working code.

  4. #4
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,114
    That kind of code will not work on two different machines. To implement something like this you will need to create a table in the back-end where you would add a record containing the user name and the form name then delete that when that same user closes the form. Then you would use a dLookup or dCount in that table to check if any current user has the form open. Might be something that you think might be "pretty" but too much hassle for the limited benefits it offers in my humble opinion.

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  5. #5
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,793
    Assuming you could get a working code, when you split the db into back and front ends it would never work to show anything on your fe copy. What is the point of wanting to know who has a form open in a stand-alone db?

    If you must do this, IMO you will have to store the facts (user name, form, etc.) in a table that is in the back end and you could check it from your fe. However, you would have to also remove a record every time the form closes, and the whole process will be somewhat unreliable.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 05-27-2015, 01:17 PM
  2. Replies: 8
    Last Post: 03-13-2015, 06:07 PM
  3. Multi Users Access database gets Inactive
    By drunkenneo in forum Access
    Replies: 3
    Last Post: 11-14-2013, 03:12 AM
  4. Replies: 2
    Last Post: 08-31-2012, 02:20 PM
  5. Multi users login form
    By johnwatkins35 in forum Forms
    Replies: 3
    Last Post: 05-15-2012, 11:39 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums