SetOption Method

Applies To

DBEngine object.

Description

Temporarily overrides values for the Microsoft Jet database engine keys in the Windows Registry (Microsoft Jet workspaces only).

Syntax

DBEngine.SetOption parameter, newvalue

The SetOption method syntax has these parts.

Part

Description

parameter

A Long constant as described in Settings.

newvalue

A Variant value that you want to set parameter to.


Settings

Each constant refers to the corresponding registry key in the path Jet\3.5\Engines
\Jet 3.5\ (that is, dbSharedAsyncDelay corresponds to the key Jet\3.5\Engines
\Jet 3.5\SharedAsyncDelay, and so on).

Constant

Description

dbPageTimeout

The PageTimeout key

dbSharedAsyncDelay

The SharedAsyncDelay key

dbExclusiveAsyncDelay

The ExclusiveAsyncDelay key

dbLockRetry

The LockRetry key

dbUserCommitSync

The UserCommitSync key

dbImplicitCommitSync

The ImplicitCommitSync key

dbMaxBufferSize

The MaxBufferSize key

dbMaxLocksPerFile

The MaxLocksPerFile key

dbLockDelay

The LockDelay key

dbRecycleLVs

The RecycleLVs key

dbFlushTransactionTimeout

The FlushTransactionTimeout key


Remarks

Use the SetOption method to override registry values at run-time. New values established with the SetOption method remain in effect until changed again by another SetOption call, or until the DBEngine object is closed.

Example

This example uses the SetOption method to change the value of two registry keys based on input from the user. The SetOption method only overrides the stored registry values for the current application. The stored settings will remain unchanged and will be the only values visible to the user through Regedit.exe.

Sub SetOptionX()

    Dim intExclusiveDelay As Integer
    Dim intSharedDelay As Integer

    ' Get user input for new values of ExclusiveAsyncDelay
    ' and SharedAsyncDelay registry keys.
    intExclusiveDelay = Val(InputBox("Enter a new value " & _
        " for the ExclusiveAsyncDelay registry key " & _
        "(in milliseconds):"))
    intSharedDelay = Val(InputBox("Enter a new value " & _
        "for the SharedAsyncDelay registry key " & _
        "(in milliseconds):"))

    If intExclusiveDelay > 0 And intSharedDelay > 0 Then
        ' Change values of registry keys.
        SetOption dbExclusiveAsyncDelay, intExclusiveDelay
        SetOption dbSharedAsyncDelay, intSharedDelay
        MsgBox "Registry keys changed to new values " & _
            "for duration of program."
    Else
        MsgBox "Registry keys left unchanged."
    End If

End Sub