Results 1 to 7 of 7
  1. #1
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Kicking People Out of a Database (A2K SR1)

    I have a database that the users frequently forget to exit. Since I can't find a utility (free of course) that I can use to kick them out, I had to come up with a way to kick the users out of forms and/or reports.

    The form uses the on timer event to launch some code that eventually if no keystrokes or mouse movement is detected, shuts the form and closes the database. Works great..... Got the idea a while ago from some posts provided in the lounge....

    HOWEVER, Reports do not have the on timer event. Any ideas on how to automatically close a report if no activity is detected (i.e., the user leaves it open) I figure I can create a timer that is launched when the form is opened. If the timer expires, then close the report. This just seems much to easy. Any ideas??
    Regards,

    Gary
    (It's been a while!)

  2. #2
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Altnau, Thurgau, Switzerland
    Posts
    447
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Kicking People Out of a Database (A2K SR1)

    How about:
    Hidden form with timer
    OnReportOpen - inform hidden form report xyz is opened
    OnReportClosed - inform hidden form the report is now closed
    Hidden form keeps track of open objects and when they were opened, checks on each timer event how long open for, close after defined period expires.
    You could also use that for your forms as well but that would require some extra coding however it could 'test' for complete inactivity within Access.
    (ps. How do you handle a dirty record / invalid record in your force closure routine?)

    Alternatively (if you feel masochistic) create a hook (C++?) into the Access message queue and let that test the Access app for inactivity.

  3. #3
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: Kicking People Out of a Database (A2K SR1)

    I like the idea of a hidden form that is controlled from the report. As to "dirty" records, I have been thinking about that as well. I will need to add some code to take care of this. Right now, the user is just severed from the db if too much time transpires. The way the data entry forms are set up, I don't think it will effect the data, but I will have to test it.

    At to C++, I am not that good with it so I tend not to use it.

    Thanks for the suggestions.
    Regards,

    Gary
    (It's been a while!)

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Kicking People Out of a Database (A2K SR1)

    A variation on Andy's suggestion would be to open the report from the form using the WithEvents keyword and instantiating a report object. That would allow the form to monitor/respond to report events without the report having to send any information back through some other mechanism. The form will know whether the report is open or not and can handle the situation appropriately.
    Charlotte

  5. #5
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Altnau, Thurgau, Switzerland
    Posts
    447
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Kicking People Out of a Database (A2K SR1)

    Thats a good extension.

  6. #6
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Altnau, Thurgau, Switzerland
    Posts
    447
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Kicking People Out of a Database (A2K SR1)

    Writing a keyboard/mouse hook is not that simple unless you are very confident in your programming abilities.

    I have used the 'hidden' form approach to implement a messaging system as there was no support for custom message handling. They can be a usefull trick in your armoury

  7. #7
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: Kicking People Out of a Database (A2K SR1)

    Thanks for the advice. I am going to go with the hidden form approach to close forms. Once again, a simple solution which I would not have thought of without the help of the lounge.
    Regards,

    Gary
    (It's been a while!)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •