• .LDB Bummer

    • This topic has 17 replies, 7 voices, and was last updated 24 years ago.
    Author
    Topic
    #353898

    Those of you using Access in a network environment feel my pain… Is there any way to alert a user that the database is already open if the matching .ldb file exists? I want BIG RED FLAGS!!! I’ve rebuilt this particular database several times due to data corruption…

    Thanks!

    Viewing 1 reply thread
    Author
    Replies
    • #518767

      Just because it is networked is no reason for concern. What is of concern is how everyone access it. Is the db split into front-end/back-end or is everyone using the SAME .mdb? Exactly what is being corrupted?

      • #518801

        Hi Drk:
        Reading your posts I must say Jim asks the question that’s been bothering me, in what way is your database being corrupted ! When split (even when shared) access works quite well with multiple users. We currently run with the db backend on a Win2K server with multiple users accessing and updating and haven’t seen a record corruption yet. Prior to splitting the backend we ran multiple users on peer to peer with a single db and again no problems. Is your database split? What version and SR are you using ? What is the nature of the corruption ? If you really want to restrict changes to a single user, you could turn on record locking but I’m not sure I really understand your predicament.

        • #518822

          Err…..

          I would go in to make a simple change to a report, say, changing a text field from this to that. While attempting to save these changes, I would get an error message, stating that the database was in an unrecognized format. I would then get another error stating that Microsoft Access could not close the database, at which time, the unrecognized database error appeared again, then the couldn’t close error, round and round we go until program termination.

          Upon re-accessing the database, all tables are gone, *le pouf* Vanished! When I clicked on the ‘Tables’ tab, I got more errors.

          The [censored][censored][censored][censored] who programmed the database used only macros to accomplish the functionality. Macros record extra things into the code, making the code unstable. I believe I have fixed this problem by deleting the macros and hard-coding the objects in the database. (it’s much more stable now…)

          I believe the cause of this corruption was not in the use of macros to code the database, but also in the multiple user environment. The entire database is one file, again, to minimize confusion if data changes of any kind occur.

          We’re all using O97SR2.

          Hope that breaks it down a bit..

          Drk.

          • #518831

            [indent]


            Upon re-accessing the database, all tables are gone, *le pouf* Vanished!


            [/indent] WHoaaa ! That is scary It’s no wonder you want to backup the tables, who wouldn’t. But I agree the problem likely doesn’t have anything to do with code Macro or otherwise. It almost sounds like prior to your recreating the .mdb the database was split and links to the backend were disappearing. That would certainly make the data appear to be lost when viewed from a frontend. I have seen the “Unrecognized database format” error occur when there are serious network problems or power failure while actually writing to a record (but for me at least that’s very rare). Sometimes running JETCOMP.EXE will recover otherwise copying the tables to a new database will generally work. Having said that, storing the data in a backend on a secure and stable server is definitely the preferred method for security and performance reasons.
            Anyhow; sorry for the tangent. I do have this piece of code I got from somewhere (I think Dev Ashish but I’m not sure).[indent]


            Option Compare Database

            ‘ Declare a record type to break down the user info

            Private Type UserRec
            bMach(1 To 32) As Byte ‘ 1st 32 bytes hold machine name
            bUser(1 To 32) As Byte ‘ 2nd 32 bytes hold user name
            End Type

            Private Sub Form_Open(Cancel As Integer)

            Me.LoggedOn.RowSource = WhosOn()

            End Sub

            Private Sub OKBtn_Click()

            DoCmd.Close A_FORM, “frmLoggedOn”

            End Sub

            Private Sub UpdateBtn_Click()

            Me.LoggedOn.RowSource = WhosOn()

            End Sub

            ‘————————————————————————————-
            ‘ Subject : WhosOn()
            ‘ Purpose : Will read *.LDB file and read who’s currently
            ‘ logged on and their station name.

            ‘ The LDB file has a 64 byte record.

            ‘ The station name starts at byte 1 and is null
            ‘ terminated.

            ‘ Log-in names start at the 33rd byte and are
            ‘ also null terminated.

            ‘ I had to change the way the file was accessed
            ‘ because the Input() function did not return
            ‘ nulls, so there was no way to see where the
            ‘ names ended.
            ‘————————————————————————————-
            Private Function WhosOn() As String

            On Error GoTo Err_WhosOn

            Dim iLDBFile As Integer, iStart As Integer
            Dim iLOF As Integer, i As Integer
            Dim sPath As String, x As String
            Dim sLogStr As String, sLogins As String
            Dim sMach As String, sUser As String
            Dim rUser As UserRec ‘ Defined in General
            Dim dbCurrent As Database

            ‘ Get Path of current database. Should substitute this code
            ‘ for an attached table path in a multi-user environment.

            Set dbCurrent = DBEngine.Workspaces(0).Databases(0)
            sPath = dbCurrent.Name
            dbCurrent.Close

            ‘ Iterate thru dbCurrent.LDB file for login names.

            sPath = Left(sPath, InStr(1, sPath, “.”)) + “LDB”

            ‘ Test for valid file, else Error

            x = Dir(sPath)
            iStart = 1
            iLDBFile = FreeFile

            Open sPath For Binary Access Read Shared As iLDBFile
            iLOF = LOF(iLDBFile)
            Do While Not EOF(iLDBFile)
            Get iLDBFile, , rUser
            With rUser
            i = 1
            sMach = “”
            While .bMach(i) 0
            sMach = sMach & Chr(.bMach(i))
            i = i + 1
            Wend
            i = 1
            sUser = “”
            While .bUser(i) 0
            sUser = sUser & Chr(.bUser(i))
            i = i + 1
            Wend
            End With
            sLogStr = sMach & ” — ” & sUser
            If InStr(sLogins, sLogStr) = 0 Then
            sLogins = sLogins & sLogStr & “;”
            End If
            iStart = iStart + 64 ‘increment to next record offset
            Loop
            Close iLDBFile
            WhosOn = sLogins

            Exit_WhosOn:
            Exit Function

            Err_WhosOn:
            If Err = 68 Then
            MsgBox “Couldn’t populate the list”, 48, “No LDB File”
            Else
            MsgBox “Error: ” & Err.Number & vbCrLf & Err.Description
            Close iLDBFile
            End If
            Resume Exit_WhosOn

            End Function


            [/indent]
            Actually looking at the code it probably wasn’t Dev Ashish. Anyway maybe it will point you in the right direction.
            Have fun,

            • #518841

              Dev Ashish is my hero!! Almost..

              For those less familiar, his site may be found at http://www.mvps.org Definitely a treasure-trove of Access Information!!

              I’ll check this out Brian, Thanks!

            • #518853

              What I experienced under Windows 95 and Access 97 was that networked databses started getting corrupt if size exceded 100 megabytes. Maybe due to network limitations of 95 or just our own local network limitations. Splitting the databases into sizes less than 100 megabytes seemed to solve this problem. Maybe you’ve already solved it, but someone else might benefit from this.

          • #518992

            You mention we (as in many users) and that the database is one file. Do you have one database with all of the tables, queries, forms etc or is it split into two databases? One for the tables. The other for the interface. If the answer is no then I would recommend you splitting this for the simple matter of backups.
            Second point. If there is one centralised database for the forms etc. then on which database do you make changes. If, as I suspect, you do it on that one copy then if anyone else that opens the database could be the cause of the corruption.
            If you want to only allow one person to open this centralised database at one time then why not open it in exclusive mode? No need for all that checking, let Access do it for you.

            • #519041

              All very good suggestions.. but there’s a problem!

              If I split the database into two, front end, back end, The performance is severely degraded. Everything becomes a long, drawn-out process. The combination of network traffic, relational structure, and sheer number of records contribute to this.. I’m working on a backup system which will automatically backup the data as time/date each time the database is closed.. that should satisfy any problems which may occur in the future, as we’ll have a few backups leading up to the problem.

              Thanks again!

              Drk.

            • #519054

              Hi Drk:
              Well, it sounds like you have a network problem. Splitting a database should improve not degrade performance, theory being, the local ‘fe’ is handling all of the grunt work and only retrieving required record information from the server ‘be’. The persistent corruption you speak of also points to network problems. But, I agree, you need to solve the immediate stability problem first. Good luck.

            • #519067

              I’m puzzled and surprised by the performance issue. However there are still many advantages to the front-end back-end structure.
              To reduce network traffic have the front-end and the back-end in the same directory. That should mean no change in the network traffic and you have the advantages of ease of backup. If that degrades the performance then something is wrong somewhere else and not with your network (try re-installing Access). The number of records/relational structure are still the same if it is one monolith or a front-end back-end.
              If you have one, central database (with both data and user interface objects) that is in use and that you (or someone else) makes changes to objects (forms, reports, modules…) as opposed to data then I suspect that could be the cause of the corruption.

    • #518820

      Though I’m guessing the corruption issue is seperate from multiple users accessing the .MDB at the same time, here is a function stolen wholesale from Susan Sales Harkins writing in the Nov. 2000 issue of Inside MS Access published by Element K. It looks to see what devices have a user lock in the .LDB file. It will return, in order, if called from the immediate window: the COMPUTER_NAME, the LOGIN_NAME, a CONNECTED flag (-1 = true), and a SUSPECTED_STATE flag (-1 = true, null = false).

      When you call the function from your PC, your name will show up as having a lock record in the .LDB. If yours is the only name, nobody else is in the db. So, you could examine the resulting recordset’s count property, if it’s >1, somebody else is connected, and you can raise that big, red flag! Judging by your ability to create great icons, I’m guessing it’d be a handsome flag at that!

      HTH, and here’s the code from Ms. Harkins.

      ~Shane
      ~~~~~~~~~~~~~~~~~~~~~
      Global Const JET_SCHEMA_USERROSTER = _
      “{947bb102-5d43-11d1-bdbf-00c04fb92675}”

      Sub ReturnUserRoster()
      Dim cnn As New ADODB.Connection
      Dim rst As ADODB.Recordset
      cnn.Open “Provider=Microsoft.Jet.OLEDB.4.0;” & _
      “Data Source=Your path and file name here;”
      Set rst = cnn.OpenSchema(adSchemaProviderSpecific _
      , , JET_SCHEMA_USERROSTER)
      Debug.Print rst.GetString
      Set rst = Nothing
      Set cnn = Nothing
      End Sub

      • #518824

        [indent]


        I’m guessing it’d be a handsome flag at that!


        [/indent] I’ll bet … I definitely want to see that screen shot

      • #518825

        do you know if this will work in ’97SR2? )

        Thanks!

        Drk.

        • #518828

          Drk:

          Erp! It makes use of ADO’s schema recordsets, so I’d guess no in 0ffice 97. Unless perhaps you set a reference to the ADO 2.x library? Dunno..but I have an unsuspecting user with ’97SR2 that I’ll go pester and see if that does do the trick!

          ~Shane

          • #518848

            Yup, it works; Win98 machine with Office 97 SR2 with references set to the ADO 2.0, 2.1, or 2.5 libraries – take yer pick!

            ~Shane

            • #518849

              Great! Thanks for all your help Shane!

              Drk.

            • #519186

              Drk,
              I have been using a front end/ back end Access db with multiple users for a few years now. I currently have Access 2K. For a while I kept having corruption problems. I narrowed it down to one computer (my old Toshiba desktop) which seemed to work fine. I gave that computer to someone who did not need the db and used another computer instead – problem solved, but I never got to the root of it.

    Viewing 1 reply thread
    Reply To: .LDB Bummer

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: