Is there an active way to disconnect users from my BE?

Guus2005

AWF VIP
Local time
Today, 20:09
Joined
Jun 26, 2007
Messages
2,636
The title says it all;

Is there an active way to disconnect users from my BE?

I used this sample database from DCrake. It has a button "Disconnect User". That's a feature i'd like to explore.

I have 45+ users in my BE database. When i want to compact it, everyone must close the connecting application. There is a hidden form which polls every 60 seconds for a setting inmy database. When this setting is true, the FE database will close automatically after a preset period of time. Most of the time it works fine but sometimes it hangs on a confirmation message box.

TIA!
 
I have not looked at DCrake's code but Jeff Conrad has several schemes listed HERE.
 
I had the same problem. In part due to staff minimizing the application.
I built a small warning form and set a macro to display this form after the timer (on open property of the form) got to 30 minutes. They could continue or exit the application. After one minute, if no responce, the application saved the data and closed. This has been a big help if the system gets an error on the server and locks. Since the application still believes the users are on-line, all I have to do is wait 30 minutes and everyone will get kicked out - then I can fix any issues. You can use a message box too, but a form allows staff who might be entering lots of data to continue.
 
You could also use the idle time feature whereby a hidden form waits for keyboard/mouse activity and if none is detected within i given time period is closed the currently open form. This can be done until it reaches the main menu form and again if no activity is detected it quits the application.

In my sample mdb I have used a text file that denotes the login caperbilities of a user, if a certain text file is found in the same path of the mdb it fails to open if the user attempts to open up their front end after you have booted them out.

All you need to do is to delete the text file from the central server to allow user access.

David
 
Thanks for all the input.

I have created a solution which i will post when there is time.

Thx!
 
I am using one of those logout prompts now, however what happens if a user has started entering a record, but there is no primary key entered (assuming autonumber is not used, this system generates the primary key only after the user has filled out info to prevent partial records etc.).

DoCmd.quit acQuitSaveNone does not get rid of the prompt that says "Index cannot be null". So the users Access would still be left open and connected to the backend.

I have tried DoCmd.Setwarnings False to no avail. I was thinking of a way to detect all other open forms, check their primary keys and do Docmd.Runcommand acCmdUndo on all of them.

Any ideas on this one?
 
Last edited:
I've tried the following code:

If CurrentProject.AllForms("frmMainItems").IsLoaded Then
If IsNull(Forms![frmMainItems]![ItemNumber]) Then
DoCmd.OpenForm "frmMainItems"
If Screen.ActiveForm.Dirty = True Then
DoCmd.RunCommand acCmdUndo
End If
End If
End If

DoCmd.Quit

But it says the Undo command is not available. I don't believe I'm running the DoCmd correctly for that form. I used the OpenForm to bring the form back into focus, I'm guessing there is another better way to do this as well.

EDIT: I used Forms!frmMainItems.Undo method and it worked... is there any disadvantage to using this, or is this the correct way?
 
Last edited:
That is what I would have suggested. Looks good.
 
You can reset everything in order to close the form properly but when you close the form without saving it prevents you from answering questions about data which needs to be saved.
Here's what i used:

Code:
    DoCmd.Close acForm, "frmMenu", acSaveNo
The Unload event quits the application
or you can use this
Code:
    Application.Quit acQuitSaveNone
HTH:D
 
FYI: the acSaveNo in
DoCmd.Close acForm, "frmMenu", acSaveNo
refers to changes to the *form* and not changes to the RecordSource of the form.
 

Users who are viewing this thread

Back
Top Bottom