Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15463

JRO Database File Size Limitations??

$
0
0
I am working with a particular client database (my design) that will "works with all features of my program but will not compact. My program stalls, no VB6 Error thrown, even though there is an error handler, and I have to Win10 "task manager" close it manually. Other client's databases (same structure) work fine, but not this one. (All the other client databases are the same except for the data contained in them.)


I note that this DB file size is about 57MB.
I also note that that in Access it will execute the Compact/Repair (not hang), but that the file size does not seem to change ( so I don't know if even Access is actually compacting/repairing the database).

On a hunch, I opened the database, and deleted about half the records, then I compacted it in Access, and now my program does not hang when it runs the database thru its compaction function.

Here is the Function:
Code:

Public Function MyCompactDB(strSRCPath As String, strTGTPath As String) As Boolean
    'IMPORTANT
    'in the strDBTarget connection string set the Engine Type number
    '  according to the JET version you are using
    '
    'Jet x.x Format MDB Files  Jet OLEDB:Engine Type
    '************************  ************************
    '        JET10                    1
    '        JET11                    2
    '        JET2X                    3
    '        JET3X                    4
    '        JET4X                    5
        '<EhHeader>
        On Error GoTo CompactDB_Err
        '</EhHeader>

    'Debug.Print "strSRCPath = "; strSRCPath
    'Debug.Print "strTGTPath = "; strTGTPath

      'On Error GoTo Err_compact
      Dim JRO As New JRO.JetEngine

      'Source and Destination connection path
      Dim strDBSource As String
      Dim strDBTarget As String

      Dim DataBase_MDW_SecurityFilePath As String

100    DataBase_MDW_SecurityFilePath = App.Path & "\Databases\MyDatabaseSecured.mdw"

102    DoEvents

104    strDBSource = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
                        "Data Source=" & strSRCPath & ";" & _
                        "Jet OLEDB:System database =" & DataBase_MDW_SecurityFilePath & ";" & _
                        "Jet OLEDB:Engine Type=5;" & _
                        "Jet OLEDB:Database Password= " & g_strJet_DB_Password & ";" & _
                        "User ID= " & g_strDBUserID & ";" & _
                        "Password = " & g_strDBPassWord & ";" & _
                        "Jet OLEDB:Encrypt Database=True"


106    strDBTarget = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
                        "Data Source=" & strTGTPath & ";" & _
                        "Jet OLEDB:System Database =" & DataBase_MDW_SecurityFilePath & ";" & _
                        "Jet OLEDB:Engine Type=5;" & _
                        "Jet OLEDB: Database Password= " & g_strJet_DB_Password & ";" & _
                        "User ID= " & g_strDBUserID & ";" & _
                        "Password = " & g_strDBPassWord & ";" & _
                        "Jet OLEDB:Encrypt Database=True"

      'JRO has a CompactDatabase method that takes two parameters:
      '  the ADO connection string for the source, and the destination database.
      '  NO NEED TO CREATE A COPY OF THE DB.
108    JRO.CompactDatabase strDBSource, strDBTarget

110    CompactDB = True
      Exit Function


'Err_compact:
'
'112    CompactDB = False
'114    Err.Description = "fso.CopyFile Error!"
'116    MsgBox Err.Description, vbExclamation

        '<EhFooter>
        Exit Function

CompactDB_Err:
        MsgBox Err.Description & vbCrLf & _
              "in xGELv2.modMain.CompactDB " & _
              "at line " & Erl
        Resume Next
        '</EhFooter>
End Function


Is there a file size limit on the JRO CompactDatabase??
Something else happening?

Ideas?

Viewing all articles
Browse latest Browse all 15463

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>