|
security
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Gaining exclusive control of the Database...We have a DB that is used by around 20 users.
My problem arises when I need to make a change, and I can't seem to find who is still in the DB. Is there any way for me to find out who it is, or to kick them out? Thanks, Ricky Painter "Rpainter" <Rpain***@discussions.microsoft.com> wrote in message Yes but it requires some coding and a new table with fields "Value" and news:8C9B29B0-A9CA-4786-BE0E-23538BBBB89A@microsoft.com... > We have a DB that is used by around 20 users. > My problem arises when I need to make a change, and I can't seem to find > who > is still in the DB. Is there any way for me to find out who it is, or to > kick them out? > "Type". Here is the code I use in the main form's timer event which you may be able to adapt. Post back if you need any explanation. Keith. www.keithwilby.com 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 Thanks for your help. First off, I'm not familiar with Basic. I'm a COBOL
guy who knows enough SQL to be dangerous... Just looking at the code, I'm guessing that the new table is called "Shutdown" and the values for this table are going to be set by the timer event. How do I set up a timer event? Thanks again for your help, Ricky Painter Show quoteHide quote > Yes but it requires some coding and a new table with fields "Value" and > "Type". Here is the code I use in the main form's timer event which you > may be able to adapt. Post back if you need any explanation. > > Keith. > www.keithwilby.com > > 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 > > > "Rpainter" <Rpain***@discussions.microsoft.com> wrote in message Yes, that's right. fOSUserName and fOSMachineName are separate functions news:4D09B6AE-DD2F-4028-B713-3EBA2D63C3C7@microsoft.com... > Thanks for your help. First off, I'm not familiar with Basic. I'm a > COBOL > guy who knows enough SQL to be dangerous... > Just looking at the code, I'm guessing that the new table is called > "Shutdown" and the values for this table are going to be set by the timer > event. lifted from here: http://www.databasedev.co.uk/get_username_or_computername.html > How do I set up a timer event? The events are built-in code modules which you access via the form's properties pallete in design view. Select "Event Procedure" from the drop-down list in the On Timer event, then click just to the right of the drop-down and it will open the module. That's where you insert the code (it's VBA code BTW). You then set the timer interval, also on the proerties pallete, in milliseconds. I have mine set to 30000 (30 seconds). > Thanks again for your help, You're welcome. Post back if you need more help.Keith. OK, I got the code loaded, but during the debug, I got an error:
"Sub or function not defined" on fOSUserName. Where and how do I need to define this? I'm sure that I will need to define the fOSMachineName also. Thanks again Show quoteHide quote "Keith Wilby" wrote: > "Rpainter" <Rpain***@discussions.microsoft.com> wrote in message > news:4D09B6AE-DD2F-4028-B713-3EBA2D63C3C7@microsoft.com... > > Thanks for your help. First off, I'm not familiar with Basic. I'm a > > COBOL > > guy who knows enough SQL to be dangerous... > > Just looking at the code, I'm guessing that the new table is called > > "Shutdown" and the values for this table are going to be set by the timer > > event. > > Yes, that's right. fOSUserName and fOSMachineName are separate functions > lifted from here: > > http://www.databasedev.co.uk/get_username_or_computername.html > > > How do I set up a timer event? > > The events are built-in code modules which you access via the form's > properties pallete in design view. Select "Event Procedure" from the > drop-down list in the On Timer event, then click just to the right of the > drop-down and it will open the module. That's where you insert the code > (it's VBA code BTW). > > You then set the timer interval, also on the proerties pallete, in > milliseconds. I have mine set to 30000 (30 seconds). > > > Thanks again for your help, > > You're welcome. Post back if you need more help. > > Keith. > > > "Rpainter" <Rpain***@discussions.microsoft.com> wrote in message Did you miss this?news:A0A43364-4A8A-42F1-A197-1B56529A9977@microsoft.com... > OK, I got the code loaded, but during the debug, I got an error: > "Sub or function not defined" > on fOSUserName. Where and how do I need to define this? > I'm sure that I will need to define the fOSMachineName also. > Show quoteHide quote >> >> Yes, that's right. fOSUserName and fOSMachineName are separate functions >> lifted from here: >> >> http://www.databasedev.co.uk/get_username_or_computername.html >> I did. Thanks for all or your help. I have all of the pieces that I need,
now all I have to do is put them together. Thanks again. I appreciate your patience. Ricky Painter Show quoteHide quote "Keith Wilby" wrote: > "Rpainter" <Rpain***@discussions.microsoft.com> wrote in message > news:A0A43364-4A8A-42F1-A197-1B56529A9977@microsoft.com... > > OK, I got the code loaded, but during the debug, I got an error: > > "Sub or function not defined" > > on fOSUserName. Where and how do I need to define this? > > I'm sure that I will need to define the fOSMachineName also. > > > > Did you miss this? > > >> > >> Yes, that's right. fOSUserName and fOSMachineName are separate functions > >> lifted from here: > >> > >> http://www.databasedev.co.uk/get_username_or_computername.html > >> > > > "Rpainter" <Rpain***@discussions.microsoft.com> wrote in message Pleasure.news:D0A8CED5-4682-4C5A-8057-D08F2F98EE58@microsoft.com... > Thanks for all or your help. Keith. |
|||||||||||||||||||||||