Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2002
    Posts
    49

    Unanswered: Database houskeeping

    I'm developing a front/back end database that will run on Windows 2k over a Novell network. Is it possible to conduct database maintenance only when the last user logs out? I suppose I could only worry about each terminal, but I'd feel better if I could do one last check when the last person exits the application. My worst fear is that a temporary table will end up trying to create a duplicate value in a primary key and cause the app to crash.

    Any ideas?

  2. #2
    Join Date
    Oct 2003
    Location
    Canada
    Posts
    574
    Check if the ldb file exists. If it does, try deleting it in case it is old. If you get an error... it is locked and the mdb is still in use.

  3. #3
    Join Date
    Nov 2002
    Posts
    49
    Originally posted by jmrSudbury
    Check if the ldb file exists. If it does, try deleting it in case it is old. If you get an error... it is locked and the mdb is still in use.
    Will that work for an application that hase a client side front end? Also, wouldn't deleting the ldb cause an error regardless since the current user is in the system? It seems to me I remember seeing a snippet of code to determine the number of users in a system, but I just forgot where!!! Thanks for the reply. Any other ideas?

  4. #4
    Join Date
    Oct 2003
    Location
    Canada
    Posts
    574
    You can only conduct backend maintenance when all users are out. If you have a main menu or switchboard always running, you could use a timer event to run code that will check if the programmer/database administrator has set a value in a control table that says KickEveryoneOut. It could keep track of when it was first set and will give the user a message every minute for 5 minutes until it just issues the command docmd.quit. As soon as the ldb files are gone, then everyone is out and the maintenance can be done.

  5. #5
    Join Date
    Nov 2002
    Posts
    49
    That is pretty much what I want to do (minus the logging everyone out, although this will be for a major update). So how should I go about doing this?

  6. #6
    Join Date
    Oct 2003
    Location
    Canada
    Posts
    574
    Assuming you have a switchboard or main menu, set the timer variable and create an event for the form_timer:

    Private Sub Form_Timer()
    If dcount("[Setting]","CtlTable","[Code]='KickEmOut' AND [Setting] = 'Yes' ") > 0 Then
    msgbox "You are being kicked out of the system.",16,"Logout"
    docmd.quit
    End If
    End Sub

Posting Permissions

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