问候, Rob Rob I''ve just spent some time looking through FAQ sites and searching thegoogle archives of this newsgroup, but I still haven''t been able tofind a clear explanation of an issue with multi-user databases.Essentially I have two questions;1) Does the system.mdw file have any significance to multi-usersharing of an Access 97 database other than security?2) Can any number of users open an Access 97 database using the sameaccount from the system.mdw without corrupting the database?What I have been doing up until now is trying to ensure that each userhas a unique account in the system.mdw and that any user connecting tothe database uses the same system.mdw. If it''s not necessary for eachuser to have a unique account, it would be much simpler to have asingle generic user account and a single standard desktop shortcut tothe front end.I can''t find any resources which clearly explain the locking system inAccess. My impression is that when a user connects to the database,an LDB file is created which contains the details of the connection.The information stored in the LDB file as shown by the Microsoft LDBviewer tool appears to be related to the computer name making theconnection *not* the user account from the system.mdw, so presumablyit shouldn''t matter if the same account is used on several differentcomputers because the locking is unique to the PC name.What *does* seem to cause problems is failing to use a system.mdw atall; which means that several users of an unsecured database areconnecting as "admin" from the system.mdw in c:\windows\system32. Interms of rights to objects, security is not of particular importancein the databases in question.Having standard desktop shortcuts which include the login account aspart of the command line would make distribution of the applicationsmuch simpler.If anyone has in depth knowledge of how the system.mdw file and theldb files behave, please let me know whether the setup for thesedatabases can be simplified...Rob 解决方案If you do have access to Access 2000 or later, the function below reads itinto an Access so you can examine its contents. Return value is the numberof distinct users currently connected.Function UserCount() As LongDim cnLocal As ADODB.Connection ''Current project connection.Dim cnBackEnd As New ADODB.Connection ''Connection to back enddatabase.Dim rsBEUserRoster As New ADODB.Recordset ''JET User Roster for backend database.Dim rsTarget As New ADODB.Recordset ''Temp table to record usersand de-dupe.Dim strPath As String ''Full path to back end.Dim strSql As String ''SQL string.Dim lngKt As Long ''Loop controller.Dim dtEnteredOn As Date ''Current date and time.''Set this to the full path of your back end database.strPath = "C:\Data\Northwind2003.mdb"''Open the JET User Roster for the back end.cnBackEnd.Provider = "Microsoft.Jet.OLEDB.4.0"cnBackEnd.Open "Data Source=" & strPathSet rsBEUserRoster = cnBackEnd.OpenSchema(adSchemaProviderSpecific, , _"{947bb102-5d43-11d1-bdbf-00c04fb92675}")''Clear temp table, and copy the user roster in.dtEnteredOn = Now()Set cnLocal = CurrentProject.ConnectioncnLocal.Execute "DELETE FROM tzJetUserRoster;"rsTarget.Open "tzJetUserRoster", cnLocal, adOpenDynamic,adLockOptimisticDo While Not rsBEUserRoster.EOFrsTarget.AddNewFor lngKt = 0 To 3rsTarget(lngKt) = rsBEUserRoster(lngKt)rsTarget!EnteredOn = dtEnteredOnNextrsTarget.UpdatersBEUserRoster.MoveNextLooprsTarget.ClosersBEUserRoster.ClosecnBackEnd.Close''Get the count of the number of distinct users who are connected.strSql = "SELECT DISTINCT Computer_Name FROM tzJetUserRoster WHEREConnected = True;"Set rsTarget = New ADODB.RecordsetrsTarget.Open strSql, cnLocal, adOpenKeysetIf Not (rsTarget.BOF And rsTarget.EOF) ThenrsTarget.MoveLastUserCount = rsTarget.RecordCountEnd IfrsTarget.Close''Dereference objectsSet rsTarget = NothingSet rsBEUserRoster = NothingSet cnLocal = NothingSet cnBackEnd = NothingEnd FunctionWhat do you mean by "the front end"? Each user should have their own - ifyou have multiple users accessing the same FE then this might causecorruption.Regards,Keith. www.keithwilby.com What do you mean by "the front end"? Each user should have their own - if you have multiple users accessing the same FE then this might cause corruption.Why would it cause corruption? We have a stack of databases whereusers open the same front end file on the server, and they don''t getcorrupted all the time. The usual reason they become corrupted isthat an individual PC had a network problem and was rebooted withoutexiting the application in a clean way.Using a single front end on the server eliminates the need todistribute the files - you only need to distribute the shortcut.Updating the front end means changing it in one place. Loading thefront end is a little slower but on a 100Mb/s switched network thespeed difference isn''t worth worrying about.When the network was slower, distributing the front end files madesense, especially if they were large. But with a fast network, Ican''t see a reason for it.Now before people start flaming me and saying "there''s your problem",I''d prefer to hear an explanation *why* opening several copies of thefront end from the server would cause corruption.Having said that, as I mentioned we''ve had a number of databasesoperating with split front end back end on the server and shortcuts onthe desktop for years - without significant problems of corruption.The point of my original post was to figure out if the system could befurther simplified by having a single generic user account in the MDWfile, and put the account name and password into the shortcut. Sincethe lock file seems to record the details of the computer connectingto the database, not the account used, it should be OK.Regards,RobRob 这篇关于Access 97 - 多用户数据库和损坏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
09-02 20:20