Hi Sebastien,
I am glad to learn that you have found a complete resoultion on this
problem. The following are some additional information that may help you:
294966.KB.EN-US PRB: RepairDatabase Method Is No Longer Available in DAO 3.6
http://support.microsoft.com/default.aspx?scid=KB;EN-US;294966
230501.KB.EN-US HOWTO: Compact Microsoft Access Database Through ADO
http://support.microsoft.com/default.aspx?scid=KB;EN-US;230501
Sincerely,
Kevin
Microsoft Support
This posting is provided "AS IS" with no warranties, and confers no rights.
Get Secure! -
www.microsoft.com/security
--------------------
| From: "Sebastien Lange" <
[email protected]>
| References: <
[email protected]>
<
[email protected]>
<#
[email protected]>
<
[email protected]>
<
[email protected]>
<
[email protected]>
<
[email protected]>
<
[email protected]>
| Subject: Re: Access Database corrupted
| Date: Thu, 16 Oct 2003 08:14:18 +0200
| Lines: 489
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <
[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.adonet
| NNTP-Posting-Host: alc245.alcatel.be 195.207.101.245
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.adonet:63746
| X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
|
| Thank you Kevin,
|
| The following method from DAO seems to work fine for any Access version.
It
| does a compact AND a repair. The documentation does not say it does a
| repair, but the RepairDatabase method documentation says we should use
| CompactDatabase instead.
|
| DBEngine.CompactDatabase olddb, newdb, locale, options, password
|
| Sebastien
|
| | > Hi Sebastien,
| >
| > I am performing researching on this question, and will get back to you
| with
| > more information as soon as possible.
| >
| > Sincerely,
| >
| > Kevin
| > Microsoft Support
| >
| > This posting is provided "AS IS" with no warranties, and confers no
| rights.
| > Get Secure! -
www.microsoft.com/security
| >
| > --------------------
| > | From: "Sebastien Lange" <
[email protected]>
| > | References: <
[email protected]>
| > <
[email protected]>
| > <#
[email protected]>
| > <
[email protected]>
| > <
[email protected]>
| > <
[email protected]>
| > | Subject: Re: Access Database corrupted
| > | Date: Mon, 13 Oct 2003 12:31:04 +0200
| > | Lines: 385
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| > | Message-ID: <
[email protected]>
| > | Newsgroups: microsoft.public.dotnet.framework.adonet
| > | NNTP-Posting-Host: alc244.alcatel.be 195.207.101.244
| > | Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| > | Xref: cpmsftngxa06.phx.gbl
| microsoft.public.dotnet.framework.adonet:63497
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
| > |
| > | I found 90% of the solution. If the user has Access XP or 2003 the
| > following
| > | code converts successfully from 2000 to 97:
| > |
| > | Type accessType = Type.GetTypeFromProgID("Access.Application");
| > | object accessApp = Activator.CreateInstance(accessType);
| > | Console.WriteLine("Access version = " +
| accessType.InvokeMember("Version",
| > | BindingFlags.GetProperty, null, accessApp, null).ToString());
| > | accessType.InvokeMember("ConvertAccessProject",
| BindingFlags.InvokeMethod,
| > | null, accessApp, new object[]{"my2Kdb.mdb", "my97db.mdb", 8});
| > |
| > | But if the user has Access 2000, there is no ConvertAccessProject
| > method...
| > | Do you know any other way/method for Access 2000 users?
| > |
| > | Sebastien
| > |
| > | | > | > Hi Sebastien,
| > | >
| > | > Yes, this is an issue. You could create three different version of
the
| > | > application. And run the application based on the version of Access
on
| > the
| > | > user's machine.
| > | >
| > | > [More Information]:
| > | >
| > | > 317113.KB.EN-US HOW TO: Automate Microsoft Access From Visual Basic
| .NET
| > | >
http://support.microsoft.com/default.aspx?scid=KB;EN-US;317113
| > | >
| > | >
| > | > Please let me know if this helps in solving your issue.
| > | >
| > | >
| > | >
| > | > Sincerely,
| > | >
| > | > Kevin
| > | > Microsoft Support
| > | >
| > | > This posting is provided "AS IS" with no warranties, and confers no
| > | rights.
| > | > Get Secure! -
www.microsoft.com/security
| > | >
| > | > --------------------
| > | > | From: "Sebastien Lange" <
[email protected]>
| > | > | References: <
[email protected]>
| > | > <
[email protected]>
| > | > <#
[email protected]>
| > | > <
[email protected]>
| > | > | Subject: Re: Access Database corrupted
| > | > | Date: Fri, 10 Oct 2003 12:01:44 +0200
| > | > | Lines: 283
| > | > | X-Priority: 3
| > | > | X-MSMail-Priority: Normal
| > | > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| > | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| > | > | Message-ID: <
[email protected]>
| > | > | Newsgroups: microsoft.public.dotnet.framework.adonet
| > | > | NNTP-Posting-Host: alc243.alcatel.be 195.207.101.243
| > | > | Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
| > | > | Xref: cpmsftngxa06.phx.gbl
| > | microsoft.public.dotnet.framework.adonet:63357
| > | > | X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
| > | > |
| > | > | Thanks Kevin,
| > | > |
| > | > | This solution works fine if all my customers have the same Access
| > | version,
| > | > | so I can reference in the conversion library the good Access
object
| > | > library.
| > | > | But I don't know which version they have. It can be 97, 2000, XP
or
| > | 2003.
| > | > | If it is 97, no conversion needed. For others, I should references
| > the 3
| > | > | object libraries (Microsoft Access 11.0 Object Library, 10.0 and
| 9.0),
| > | > isn't
| > | > | it? but I don't think I can!!!
| > | > |
| > | > | Sebastien
| > | > |
| > | > | | > | > | > Hi Sebastien,
| > | > | >
| > | > | > We can programmatically convert the Access 2000/2002 format to
| > Access
| > | 97
| > | > | by
| > | > | > using the Access object library. The following is the article,
| > please
| > | > test
| > | > | > the method to see if it works for you:
| > | > | >
| > | > | >
| > | > | > Q304318 ACC2002: Programmatically Convert Multiple Access
| Databases
| > | > | >
http://support.microsoft.com/support/kb/articles/q304/3/18.asp
| > | > | >
| > | > | > The /convert switch cannot detect the DefaultDatabaseFormat
| > property.
| > | In
| > | > | > Access 2002, the switch can convert the database only into
Access
| > 2000
| > | > | file
| > | > | > format.
| > | > | >
| > | > | >
| > | > | >
| > | > |
| > | >
| > |
| >
|
============================================================================
| > | > | > ===
| > | > | >
| > | >
| >
--------------------------------------------------------------------------
| > | > | --
| > | > | > ---
| > | > | > The information in this article applies to:
| > | > | >
| > | > | > - Microsoft Access 2002
| > | > | >
| > | > | >
| > | >
| >
--------------------------------------------------------------------------
| > | > | --
| > | > | > ---
| > | > | >
| > | > | >
| > | > | >
| > | > | > Advanced: Requires expert coding, interoperability, and
multiuser
| > | > skills.
| > | > | >
| > | > | >
| > | > | >
| > | > | > This article applies only to a Microsoft Access database (.mdb).
| > | > | >
| > | > | >
| > | > | >
| > | > | >
| > | > | > SUMMARY
| > | > | > =======
| > | > | >
| > | > | >
| > | > | > This article shows you two methods that you can use to
| > | programmatically
| > | > | > convert Microsoft Access databases. The first method uses the
| > | > | > ConvertAccessProject method to convert databases to the format
| that
| > | you
| > | > | > specify. The second method uses the Shell function to run
| > Msaccess.exe
| > | > | with
| > | > | > the /convert switch. This second method is embedded in a comment
| > block
| > | > in
| > | > | > the sample code. When you use the second method, the databases
| will
| > be
| > | > | > converted to Access 2000 file format regardless of the Default
| File
| > | > Format
| > | > | > that is specified in the Options dialog box on the Tools menu.
| > | > | >
| > | > | >
| > | > | > MORE INFORMATION
| > | > | > ================
| > | > | >
| > | > | > Microsoft provides programming examples for illustration only,
| > without
| > | > | > warranty either
| > | > | > expressed or implied, including, but not limited to, the implied
| > | > | warranties
| > | > | > of
| > | > | > merchantability and/or fitness for a particular purpose. This
| > article
| > | > | > assumes
| > | > | > that you are familiar with the programming language being
| > demonstrated
| > | > and
| > | > | > the
| > | > | > tools used to create and debug procedures. Microsoft support
| > | > professionals
| > | > | > can
| > | > | > help explain the functionality of a particular procedure, but
they
| > | will
| > | > | not
| > | > | > modify these examples to provide added functionality or
construct
| > | > | > procedures to
| > | > | > meet your specific needs. If you have limited programming
| > experience,
| > | > you
| > | > | > may
| > | > | > want to contact a Microsoft Certified Partner or the Microsoft
| > | fee-based
| > | > | > consulting line at (800) 936-5200. For more information about
| > | Microsoft
| > | > | > Certified
| > | > | > Partners, please visit the following Microsoft Web site:
| > | > | >
| > | > | >
| > | > | >
| > | > | >
http://www.microsoft.com/partner/referral/
| > | > | >
| > | > | >
| > | > | >
| > | > | > For more information about the support options that are
available
| > and
| > | > | about
| > | > | > how to contact Microsoft, visit the following Microsoft Web
site:
| > | > | >
| > | > | >
| > | > | >
| > | > | >
http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS
| > | > | >
| > | > | > 1. Open a new or an existing database.
| > | > | >
| > | > | > 2. On the Insert menu, click Module. Type the following line in
| the
| > | > | > Declarations section if it is not already there:
| > | > | >
| > | > | >
| > | > | > Option Explicit
| > | > | >
| > | > | >
| > | > | > 3. Type or paste the following procedure:
| > | > | >
| > | > | >
| > | > | > Sub ConvertDb(oldDbPath As String, newDbPath As String)
| > | > | >
| > | > | > 'NOTE: Uncomment the line Dim x if you are using the
| > | > | > 'alternative Shell function method listed later in this code.
| > | > | >
| > | > | > 'Dim x
| > | > | >
| > | > | > Dim strDBName As String
| > | > | > Dim strOLDDB As String
| > | > | > Dim strNewDb As String
| > | > | >
| > | > | > strDBName = Dir(oldDbPath & "\*.MDB") ' Retrieve the first MDB
| > file
| > | > | > entry.
| > | > | >
| > | > | > 'Loop though the files in the folder to find MDB files.
| > | > | >
| > | > | > Do While strDBName <> ""
| > | > | > ' Ignore the current folder and the encompassing folder.
| > | > | > If strDBName <> "." And strDBName <> ".." Then
| > | > | >
| > | > | > If Right(strDBName, 3) = "mdb" Then
| > | > | > strOLDDB = oldDbPath & "\" & strDBName
| > | > | > strNewDb = newDbPath & "\" & strDBName
| > | > | >
| > | > | > 'NOTE: Comment out the following four lines if you are
| using
| > | the
| > | > | > 'Shell function method.
| > | > | >
| > | > | > Application.ConvertAccessProject _
| > | > | > SourceFilename:=strOLDDB, _
| > | > | > DestinationFilename:=strNewDb, _
| > | > | > DestinationFileFormat:=acFileFormatAccess2000
| > | > | >
| > | > | > 'NOTE: The alternative method is to use the Shell
function
| to
| > | > open
| > | > | > 'Access and concatenate the Convert switch instead of
using
| > the
| > | > | > 'ConvertAccessProject method. To use this method,
uncomment
| > the
| > | > | > 'following two lines.
| > | > | >
| > | > | > ' x = Shell("C:\Program Files\Microsoft
| > | > | > Office\Office10\MSACCESS.EXE " & Chr(34) _
| > | > | > ' & strOLDDB & Chr(34) & " /Convert " & Chr(34) &
| > strNewDb
| > | &
| > | > | > Chr(34))
| > | > | >
| > | > | > MsgBox "Conversion complete."
| > | > | > End If
| > | > | > End If
| > | > | > strDBName = Dir ' Get next MDB.
| > | > | > Loop
| > | > | >
| > | > | > End Sub
| > | > | >
| > | > | >
| > | > | >
| > | > | >
| > | > | > 4. To test this function, create two folders in the root
directory
| > of
| > | > | drive
| > | > | > C. Name the folders "DatabasesToConvert" (without the quotation
| > | marks)
| > | > | and
| > | > | > "ConvertedDatabases" (without the quotation marks). Put the
| > databases
| > | > | that
| > | > | > you want to convert in the DatabasesToConvert folder, type the
| > | following
| > | > | > line in the Immediate window, and then press ENTER:
| > | > | >
| > | > | >
| > | > | >
| > | > | > call ConvertDb("C:\DatabasesToConvert", "C:\ConvertedDatabases")
| > | > | >
| > | > | >
| > | > | >
| > | > | > REFERENCES
| > | > | > ==========
| > | > | >
| > | > | > For more information about the ConvertAccessProject method, in
| the
| > | > Visual
| > | > | > Basic Editor, click Microsoft Visual Basic Help on the Help
menu,
| > type
| > | > | > convertaccessproject in the Office Assistant or the Answer
Wizard,
| > and
| > | > | then
| > | > | > click Search to view the topic.
| > | > | >
| > | > | >
| > | > | > For additional information about database conversion, click the
| > | article
| > | > | > number below
| > | > | > to view the article in the Microsoft Knowledge Base:
| > | > | >
| > | > | >
| > | > | >
| > | > | > KBLink:319400.KB.EN-US: ACC2002: Conversion White Paper
Available
| in
| > | > | > the Download Center
| > | > | >
| > | > | >
| > | > | >
| > | > | >
| > | > | > Sincerely,
| > | > | >
| > | > | > Kevin
| > | > | > Microsoft Support
| > | > | >
| > | > | > This posting is provided "AS IS" with no warranties, and confers
| no
| > | > | rights.
| > | > | > Get Secure! -
www.microsoft.com/security
| > | > | >
| > | > | > --------------------
| > | > | > | From: "Sebastien Lange" <
[email protected]>
| > | > | > | References: <
[email protected]>
| > | > | > <
[email protected]>
| > | > | > | Subject: Re: Access Database corrupted
| > | > | > | Date: Fri, 10 Oct 2003 08:18:19 +0200
| > | > | > | Lines: 37
| > | > | > | X-Priority: 3
| > | > | > | X-MSMail-Priority: Normal
| > | > | > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| > | > | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| > | > | > | Message-ID: <#
[email protected]>
| > | > | > | Newsgroups: microsoft.public.dotnet.framework.adonet
| > | > | > | NNTP-Posting-Host: alc243.alcatel.be 195.207.101.243
| > | > | > | Path:
| > cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| > | > | > | Xref: cpmsftngxa06.phx.gbl
| > | > | microsoft.public.dotnet.framework.adonet:63347
| > | > | > | X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
| > | > | > |
| > | > | > | See
|
http://support.microsoft.com/default.aspx?scid=kb;en-us;306287
| > | > | > |
| > | > | > |
| > | > | > |
| > | > | > | | > | > | > | > What is JRO? I need to be able to compact an Access db. It
| > sounds
| > | > like
| > | > | > you
| > | > | > | >
| > | > | > | > know how to do it. Can you explain it to me?
| > | > | > | >
| > | > | > | > Don
| > | > | > | >
in
| > | > message
| > | > | > | > | > | > | > | > > Hi,
| > | > | > | > >
| > | > | > | > > It seems not possible to repair an access DB
| programmatically
| > | with
| > | > | > | > ADO.NET.
| > | > | > | > > JRO only compact it, without repairing.
| > | > | > | > > The only way seems to use MS Office PIAs.
| > | > | > | > > My customers have Access 97. Is there PIAs for 97? I
suppose
| > no!
| > | > | Only
| > | > | > | for
| > | > | > | > XP
| > | > | > | > > & 2003, isn't it?
| > | > | > | > > Then the only possiblity seems to launch Access 97 with my
| mdb
| > | as
| > | > | > | > > argument... and ask the customer to do it himself? any
other
| > | > idea???
| > | > | > Or
| > | > | > | > > create a com dll that reference Access 97 and then try to
| > repair
| > | > it?
| > | > | > | > > Any idea?
| > | > | > | > >
| > | > | > | > > Thanks,
| > | > | > | > > Sebastien
| > | > | > | > >
| > | > | > | > >
| > | > | > | >
| > | > | > | >
| > | > | > |
| > | > | > |
| > | > | > |
| > | > | >
| > | > |
| > | > |
| > | > |
| > | >
| > |
| > |
| > |
| >
|
|
|