Article View: pl.comp.bazy-danych.msaccess
Article #137698Naprawa bazy danych
From: Phantom
Date: Mon, 23 Mar 2020 11:53
Date: Mon, 23 Mar 2020 11:53
64 lines
3901 bytes
3901 bytes
Witam
Kod na naprawę bazy danych przestał działać.
Przesiadłem się z Access2000 na Access2019 i poniższy kod przestał mi działać.
Jest to skrypt vbs dla MSAccess2000 czyli ("Access.Application.9").
Teraz mam bazę z rozszerzeniem accdb.
Próbowałem zmieniać w treści kodu z Access.Application.9 na wyższy numer ale nic to nie daje.
Proszę o pomoc.
' ***************** BEGIN CODE HERE ' *****************
'
Dim objScript
Dim objAccess
Dim strPathToMDB
Dim strMsg
' ///////////// NOTE: User must edit variables in this section /////
'
' The following line of code is the only variable that need be edited
' You must provide a path to the Access MDB which will be compacted
'
strPathToMDB = "C:\Users\mduda\Desktop\Awaria\Dp07baza.accdb"
'
' ////////////////////////////////////////////////////////////////
' Set a name and path for a temporary mdb file
strTempDB = "C:\Users\mduda\Desktop\Awaria\Comp0001.accdb"
' Create Access 97 Application Object
'Set objAccess = CreateObject("Access.Application.8")
' For Access 2000, use Application.9
Set objAccess = CreateObject("Access.Application.9")
' Perform the DB Compact into the temp mdb file
' (If there is a problem, then the original mdb is preserved)
'objAccess.DbEngine.CompactDatabase strPathToMDB ,strTempDB
objAccess.DbEngine.CompactDatabase strPathToMDB ,strTempDB, , , ";pwd=" & "1234"
If Err.Number > 0 Then
' There was an error. Inform the user and halt execution
strMsg = "The following error was encountered while compacting database:"
strMsg = strMsg & vbCrLf & vbCrLf & Err.Description
Else
' Create File System Object to handle file manipulations
Set objScript= CreateObject("Scripting.FileSystemObject")
' Back up the original file as Filename.mdbz. In case of undetermined
' error, it can be recovered by simply removing the terminating "z".
'objScript.CopyFile strPathToMDB , strPathToMDB & "z", True
objScript.CopyFile strPathToMDB , strPathToMDB & "_" & Date(), True
' Copy the compacted mdb by into the original file name
objScript.CopyFile strTempDB, strPathToMDB, True
' We are finished with TempDB. Kill it.
objScript.DeleteFile strTempDB
End If
' Always remember to clean up after yourself
Set objAccess = Nothing
Set objScript = Nothing
'
' ****************** END CODE HERE ' ******************
Technical Details
Message-ID:
<4e915100-1c4d-4449-89ac-a848401499cb@googlegroups.com>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed.pionier.net.pl!3.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder.eternal-september.org!feeder5.feed.usenet.farm!feed.usenet.farm!tr3.eu1.usenetexpress.com!feeder.usenetexpress.com!tr1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mailShow Full Headers
Complete Article Headers
X-Received: by 2002:a37:e509:: with SMTP id e9mr4614987qkg.177.1584964406234; Mon, 23 Mar 2020 04:53:26 -0700 (PDT) X-Received: by 2002:a37:678b:: with SMTP id b133mr20624541qkc.327.1584964406000; Mon, 23 Mar 2020 04:53:26 -0700 (PDT) Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed.pionier.net.pl!3.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder.eternal-september.org!feeder5.feed.usenet.farm!feed.usenet.farm!tr3.eu1.usenetexpress.com!feeder.usenetexpress.com!tr1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: pl.comp.bazy-danych.msaccess Date: Mon, 23 Mar 2020 04:53:25 -0700 (PDT) Complaints-To: groups-abuse@google.com Injection-Info: google-groups.googlegroups.com; posting-host=185.233.26.174; posting-account=ktj0zQoAAADJqs80HwZLH7C5CXWNQqRK NNTP-Posting-Host: 185.233.26.174 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <4e915100-1c4d-4449-89ac-a848401499cb@googlegroups.com> Subject: Naprawa bazy danych From: Phantom <biuro.tekaoprogramowanie@gmail.com> Injection-Date: Mon, 23 Mar 2020 11:53:26 +0000 Lines: 69 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit