Who's got the database open?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I have the following subroutine attached to the OnOpen method of our database
switchboard:

Dim fs, f, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.getfile("\\servername\rest of path\database name.ldb")
s = UCase(f.Name) & " uses " & f.Size & " bytes."

If f.Size = 64 Then
Exit Sub

Else
MsgBox "The database is in use. Please try again later.", _
vbExclamation, "Sorry..."
mcrQuit 'this is the name of a function in a module

End If

Set f = Nothing
Set fs = Nothing

Please, without passing judgement about how it would be more efficient to
split the thing, which I intend to do over the summer break, but until
then... for obvious reasons, it is important to disallow multiple users
accessing it at once. The above code works, but...

Is there any way I can include the domain username of the person logged onto
the workstation on which the database is already open in the message box
text? This would really help track down folks who forget and leave it open!

I already have a module that reads the domain username and the domain name
that I use for other things. Can I somehow utilize the GetUser function for
this task?

As always, thank you in advance for any suggestions.

--
BJM
ACE Assistant
Gary Allan High School
.



Relevant Pages

  • Re: Authentication
    ... I guess than you must have corresponding id for Domain Username in your ... database. ... ' Check if user is a member of the NT Domain ... and then run your query. ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: Is This Possible ... ? Yes - Upload images to an Access database
    ... It looks like your databases folder is outside the root of your web ... I created a database exactly as you said, the only change I made was to ... and underneath an 'upload' button and a 'view images' button. ... Dim con As New Data.OleDb.OleDbConnection ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Is This Possible ... ? Yes - Upload images to an Access database
    ... It looks like your databases folder is outside the root of your web ... I created a database exactly as you said, the only change I made was to ... and underneath an 'upload' button and a 'view images' button. ... Dim con As New Data.OleDb.OleDbConnection ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Is This Possible ... ? Yes - Upload images to an Access database
    ... I created a database exactly as you said, the only change I made was to ... upload it into the 'databases' folder, and not a folder called 'App_Data', ... and underneath an 'upload' button and a 'view images' button. ... Dim con As New Data.OleDb.OleDbConnection ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: mailmerge and sql
    ... that is essentially a database application with a document ... the recordset to the Word Template and use it as if I got ... >> using an ADO recordset as a datasource (if it could be ... >Dim oCatalog As ADOX.Catalog ...
    (microsoft.public.word.mailmerge.fields)