PC Review


Reply
Thread Tools Rate Thread

Disconnect users

 
 
=?Utf-8?B?SWdvciBHLg==?=
Guest
Posts: n/a
 
      3rd Aug 2007
How disconnect all users connected to database?
I have problem time to time with update, because always is someone connected.
Thanks!
 
Reply With Quote
 
 
 
 
Keith Wilby
Guest
Posts: n/a
 
      3rd Aug 2007
"Igor G." <(E-Mail Removed)> wrote in message
news:83B2F79B-5CB8-4CA6-9DE8-(E-Mail Removed)...
> How disconnect all users connected to database?
> I have problem time to time with update, because always is someone
> connected.
> Thanks!


There is no built-in function that will do this, you have to code it
yourself and it is not a trivial job. If you have coding skills then this
will point you in the right direction:

Private Sub Form_Timer()

On Error Resume Next
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim dtmTimeOut As Date
Dim varType As Variant
Dim varValue As Variant

Set db = CurrentDb()
Set rs = db.OpenRecordset("qtblShutdown")
Do While Not rs.EOF
varValue = rs!Value
If Not IsNull(varValue) Then
Select Case rs!Type
Case "User"
If varValue = fOSUserName() Then
DoCmd.OpenForm "fdlgShutdown", , , , , acDialog
mfTimedOut = True
DoCmd.Close acForm, Me.Name
End If
Case "Computer":
If varValue = fOSMachineName Then
DoCmd.OpenForm "fdlgShutdown", , , , , acDialog
mfTimedOut = True
DoCmd.Close acForm, Me.Name
End If
Case "Time"
dtmTimeOut = varValue
If mdtmTime < dtmTimeOut And Time > dtmTimeOut Then
DoCmd.OpenForm "fdlgShutdown", , , , , acDialog
mfTimedOut = True
DoCmd.Close acForm, Me.Name
End If
End Select
End If
rs.MoveNext
Loop

End Sub

Using this method you can target all users, a specific user or a specific
computer.

Keith.
www.keithwilby.com

 
Reply With Quote
 
=?Utf-8?B?SWdvciBHLg==?=
Guest
Posts: n/a
 
      3rd Aug 2007
Thanks;
I just want to disconnect all connected users or computers.
How to modify this code?

"Keith Wilby" wrote:

> "Igor G." <(E-Mail Removed)> wrote in message
> news:83B2F79B-5CB8-4CA6-9DE8-(E-Mail Removed)...
> > How disconnect all users connected to database?
> > I have problem time to time with update, because always is someone
> > connected.
> > Thanks!

>
> There is no built-in function that will do this, you have to code it
> yourself and it is not a trivial job. If you have coding skills then this
> will point you in the right direction:
>
> Private Sub Form_Timer()
>
> On Error Resume Next
> Dim db As DAO.Database
> Dim rs As DAO.Recordset
> Dim dtmTimeOut As Date
> Dim varType As Variant
> Dim varValue As Variant
>
> Set db = CurrentDb()
> Set rs = db.OpenRecordset("qtblShutdown")
> Do While Not rs.EOF
> varValue = rs!Value
> If Not IsNull(varValue) Then
> Select Case rs!Type
> Case "User"
> If varValue = fOSUserName() Then
> DoCmd.OpenForm "fdlgShutdown", , , , , acDialog
> mfTimedOut = True
> DoCmd.Close acForm, Me.Name
> End If
> Case "Computer":
> If varValue = fOSMachineName Then
> DoCmd.OpenForm "fdlgShutdown", , , , , acDialog
> mfTimedOut = True
> DoCmd.Close acForm, Me.Name
> End If
> Case "Time"
> dtmTimeOut = varValue
> If mdtmTime < dtmTimeOut And Time > dtmTimeOut Then
> DoCmd.OpenForm "fdlgShutdown", , , , , acDialog
> mfTimedOut = True
> DoCmd.Close acForm, Me.Name
> End If
> End Select
> End If
> rs.MoveNext
> Loop
>
> End Sub
>
> Using this method you can target all users, a specific user or a specific
> computer.
>
> Keith.
> www.keithwilby.com
>
>

 
Reply With Quote
 
=?Utf-8?B?RGFuaWVs?=
Guest
Posts: n/a
 
      3rd Aug 2007
Look at

http://www.rogersaccesslibrary.com/d...ogUsersOff.mdb

This is exactly what you need to implement.
--
Hope this helps,

Daniel P





"Igor G." wrote:

> Thanks;
> I just want to disconnect all connected users or computers.
> How to modify this code?
>
> "Keith Wilby" wrote:
>
> > "Igor G." <(E-Mail Removed)> wrote in message
> > news:83B2F79B-5CB8-4CA6-9DE8-(E-Mail Removed)...
> > > How disconnect all users connected to database?
> > > I have problem time to time with update, because always is someone
> > > connected.
> > > Thanks!

> >
> > There is no built-in function that will do this, you have to code it
> > yourself and it is not a trivial job. If you have coding skills then this
> > will point you in the right direction:
> >
> > Private Sub Form_Timer()
> >
> > On Error Resume Next
> > Dim db As DAO.Database
> > Dim rs As DAO.Recordset
> > Dim dtmTimeOut As Date
> > Dim varType As Variant
> > Dim varValue As Variant
> >
> > Set db = CurrentDb()
> > Set rs = db.OpenRecordset("qtblShutdown")
> > Do While Not rs.EOF
> > varValue = rs!Value
> > If Not IsNull(varValue) Then
> > Select Case rs!Type
> > Case "User"
> > If varValue = fOSUserName() Then
> > DoCmd.OpenForm "fdlgShutdown", , , , , acDialog
> > mfTimedOut = True
> > DoCmd.Close acForm, Me.Name
> > End If
> > Case "Computer":
> > If varValue = fOSMachineName Then
> > DoCmd.OpenForm "fdlgShutdown", , , , , acDialog
> > mfTimedOut = True
> > DoCmd.Close acForm, Me.Name
> > End If
> > Case "Time"
> > dtmTimeOut = varValue
> > If mdtmTime < dtmTimeOut And Time > dtmTimeOut Then
> > DoCmd.OpenForm "fdlgShutdown", , , , , acDialog
> > mfTimedOut = True
> > DoCmd.Close acForm, Me.Name
> > End If
> > End Select
> > End If
> > rs.MoveNext
> > Loop
> >
> > End Sub
> >
> > Using this method you can target all users, a specific user or a specific
> > computer.
> >
> > Keith.
> > www.keithwilby.com
> >
> >

 
Reply With Quote
 
=?Utf-8?B?S2xhdHV1?=
Guest
Posts: n/a
 
      3rd Aug 2007
Igor,

From your post I would guess your database is not split; otherwise, this
would be a trivial problem.
It is rare that the data definition portion of a database changes. By that,
I mean adding, deleting, or changing fields, field definitions,
relationships, or indices. Most updates are in the application portion of a
database. This is the front end which contains forms, reports, macros,
queries, and code. Each user should have a copy of the front end on their
own computer. It should not be shared on a network. Multiple users sharing
a front end is a big contributer to corruption.

Once you have made modifications, then the issue is how to deploy the new
version. There are ways to make the upate automatic or semi automatic, but
before you get into that, I would strongly suggest you split your database
and properly deploy it.
--
Dave Hargis, Microsoft Access MVP


"Igor G." wrote:

> How disconnect all users connected to database?
> I have problem time to time with update, because always is someone connected.
> Thanks!

 
Reply With Quote
 
=?Utf-8?B?SWdvciBHLg==?=
Guest
Posts: n/a
 
      6th Aug 2007
Database is splitted, and I just want to disconnect all users when is needed.

Example:
When I click on command button in secret menu all users must be disconnected.
Thanks!

"Klatuu" wrote:

> Igor,
>
> From your post I would guess your database is not split; otherwise, this
> would be a trivial problem.
> It is rare that the data definition portion of a database changes. By that,
> I mean adding, deleting, or changing fields, field definitions,
> relationships, or indices. Most updates are in the application portion of a
> database. This is the front end which contains forms, reports, macros,
> queries, and code. Each user should have a copy of the front end on their
> own computer. It should not be shared on a network. Multiple users sharing
> a front end is a big contributer to corruption.
>
> Once you have made modifications, then the issue is how to deploy the new
> version. There are ways to make the upate automatic or semi automatic, but
> before you get into that, I would strongly suggest you split your database
> and properly deploy it.
> --
> Dave Hargis, Microsoft Access MVP
>
>
> "Igor G." wrote:
>
> > How disconnect all users connected to database?
> > I have problem time to time with update, because always is someone connected.
> > Thanks!

 
Reply With Quote
 
=?Utf-8?B?S2xhdHV1?=
Guest
Posts: n/a
 
      6th Aug 2007
Keith's response is what you need.
--
Dave Hargis, Microsoft Access MVP


"Igor G." wrote:

> Database is splitted, and I just want to disconnect all users when is needed.
>
> Example:
> When I click on command button in secret menu all users must be disconnected.
> Thanks!
>
> "Klatuu" wrote:
>
> > Igor,
> >
> > From your post I would guess your database is not split; otherwise, this
> > would be a trivial problem.
> > It is rare that the data definition portion of a database changes. By that,
> > I mean adding, deleting, or changing fields, field definitions,
> > relationships, or indices. Most updates are in the application portion of a
> > database. This is the front end which contains forms, reports, macros,
> > queries, and code. Each user should have a copy of the front end on their
> > own computer. It should not be shared on a network. Multiple users sharing
> > a front end is a big contributer to corruption.
> >
> > Once you have made modifications, then the issue is how to deploy the new
> > version. There are ways to make the upate automatic or semi automatic, but
> > before you get into that, I would strongly suggest you split your database
> > and properly deploy it.
> > --
> > Dave Hargis, Microsoft Access MVP
> >
> >
> > "Igor G." wrote:
> >
> > > How disconnect all users connected to database?
> > > I have problem time to time with update, because always is someone connected.
> > > Thanks!

 
Reply With Quote
 
Keith Wilby
Guest
Posts: n/a
 
      7th Aug 2007
"Igor G." <(E-Mail Removed)> wrote in message
news:3D8F6A34-7259-4030-A9F0-(E-Mail Removed)...
> Thanks;
> I just want to disconnect all connected users or computers.
> How to modify this code?
>


You don't need to modify it at all. What you do need is a table
"tblShutdown" with the two fields Type and Value. You then need a query
"qtblShutdown" based on the table. To disconnect all users, put "time" in
the "Type" field and a suitable time (hh:mm) in the "Value" field. So if
it's 14:00 put "14:05" as the time value and see what happens.

The code goes in your form's Timer event and the timer interval should be
set to how often you want the code to check the table (30 seconds is
adequate for me).

You also need this code to run in your main form's Open event so that it
will foil any user's attempt to open it whilst you have it "off-line".

"fdlgShutdown" is just a form that warns the user that the app is about to
close.

HTH - Keith.
www.keithwilby.com

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Programatically disconnect users from SQL Marc Jennings Microsoft C# .NET 1 18th Jul 2005 09:05 PM
disconnect users from the server sphilip Microsoft Windows 2000 1 4th Apr 2004 12:41 PM
Disconnect users Phjart Microsoft Access 2 18th Nov 2003 07:59 PM
How do I disconnect users from a DB? Ian Weiting Microsoft Access 1 7th Aug 2003 09:05 PM
Batch Disconnect Users Matthew Microsoft Windows 2000 Networking 3 8th Jul 2003 10:55 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:45 AM.