Results 1 to 4 of 4

Thread: Compact Database Error

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2001
    Location
    USA
    Posts
    1,026

    Compact Database Error

    The following code is erroring out on the bolded line

    VB Code:
    1. Dim lcStrSource As String
    2.         Dim lcStrTarget As String
    3.         Dim lcStrEngine As String
    4.         Dim lcObjJRO As JRO.JetEngine
    5.  
    6.         lcObjJRO = New JRO.JetEngine
    7.  
    8.         lcStrSource = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = " & DBLoc & "; Persist Security Info = False;Jet OLEDB:Engine Type=4"
    9.         lcStrTarget = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = " & DBLoc2 & "; Persist Security Info = False;Jet OLEDB:Engine Type=4"
    10.  
    11.         [b]lcObjJRO.CompactDatabase(lcStrSource, lcStrTarget)[/b]
    12.  
    13.         Kill(DBLoc)
    14.         Rename(DBLoc2, DBLoc)
    15.  
    16.         MsgBox("Database Compacted")

    It's giving me:

    Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.


    Any ideas?

    Squirrelly1
    Now happily married and still crankin' away at the keyboard. Life is grand for a coder, no?

  2. #2
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    here is a line from a backup utility i wrote that i know works..

    VB Code:
    1. jeCompact.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & SourceDB, "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DestDB & ";Jet OLEDB:Engine Type=5"

    where of course SourceDB and DestDB are the source and destination paths... i think this backed up office 2000 DBs if im not mistaken which was engine type 5.. i noticed you had 4.. what access year MDB are you backing up? also dont know if it matters.. but i didn't use spaces between the item=value in the string

  3. #3
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690
    I have no idea if this applies or not, but I have seen this error in a (very strange) programming language called Magic. It happens when the indices I have defined on the programming side do not match the indices defined in the database.

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2001
    Location
    USA
    Posts
    1,026
    Aha!

    I had my Type = 4...

    Thanks

    Squirrelly1
    Now happily married and still crankin' away at the keyboard. Life is grand for a coder, no?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width