Форумы HiProg.com - MS ACCESS, VBA, VB

 

Ответить на сообщение

Вернуться к теме

Вы отвечаете на сообщение:

ник: osmor
для MSA97:

SysCmd 602, strPathSourceMdb, strPathDestinationMdb

для остальных 200 и выше:
из Help:

Example:
The following example compacts and repairs a database, creates a log if there's any corruption in the source file, and returns a Boolean value based on whether the recovery was successful. For the example to work, you must pass it the paths and file names of the source and destination files.


Function RepairDatabase(strSource As String, _
        strDestination As String) As Boolean
        ' Input values: the paths and file names of
        ' the source and destination files.

    ' Trap for errors.
    On Error GoTo error_handler

    ' Compact and repair the database. Use the return value of
    ' the CompactRepair method to determine if the file was
    ' successfully compacted.
    RepairDatabase = _
        Application.CompactRepair( _
        LogFile:=True, _
        SourceFile:=strSource, _
        DestinationFile:=strDestination)

    ' Reset the error trap and exit the function.
    On Error GoTo 0
    Exit Function

' Return False if an error occurs.
error_handler:
    RepairDatabase = False

End Function


Для всех версий, нужна ссылка на DAO:
опять из Help:

Sub CompactDatabaseX()

    Dim dbsNorthwind As Database

    Set dbsNorthwind = OpenDatabase("Борей.mdb")

    ' Отображает свойства исходной базы данных.
    With dbsNorthwind
        Debug.Print .Name & ", версия " & .Version
        Debug.Print "    Порядок символов = " & .CollatingOrder
        .Close
    End With

    ' Проверяет наличие файла, имеющего имя, которое 
    ' будет присвоено сжатой базе данных.
    If Dir("БорейКорея.mdb") <> "" Then _
        Kill "БорейКорея.mdb"


' Создает сжатую копию базы данных "Борей",
    ' в которой используется порядок символов
    ' корейского языка.
    DBEngine.CompactDatabase "Борей.mdb", _
        "БорейКорея.mdb", dbLangKorean

    Set dbsNorthwind = OpenDatabase("БорейКорея.mdb")

    ' Отображает свойства сжатой базы данных.
    With dbsNorthwind
        Debug.Print .Name & ", версия " & .Version
        Debug.Print "    Порядок символов = " & .CollatingOrder
        .Close
    End With

End Sub


Ваше имя:

Пароль:

Цитировать: [quote][/quote] Код: [code][/code]
Жирный: [b][/b] Наклонный: [i][/i]
URL: [url][/url] 

Сообщение:

 Размер файла не более 50 Кбт. Большие файлы можно размещать на www.slil.ru

Прикрепить:

 

Для вставки смайлов в текст щелкните по значку.