[AccessD] Operation Not Supported...

John Colby jwcolby at gmail.com
Sun Oct 16 06:35:09 CDT 2022


Is it a compile error or a run time error?  You always need an error
handler.  On Error Goto ErrorLabel as the first line of the sub.  Then
somewhere down below an error label, usually as the last line of the sub.
See the example (actual code form a class).

Now when a run time error occurs the execution vectors to the error handler
and you can see what it was and even "resume 0" to go execute the line with
the error again.

Private Sub Class_Initialize()
On Error GoTo Err_Class_Initialize
    assDebugPrint "initialize " & mcstrModuleName, DebugPrint
    Set mclsGlobalInterface = New clsGlobalInterface
Exit_Class_Initialize:
Exit Sub
Err_Class_Initialize:
        MsgBox Err.Description, , "Error in Sub
clsTemplate.Class_Initialize"
        Resume Exit_Class_Initialize
    Resume 0    '.FOR TROUBLESHOOTING
End Sub

On Sun, Oct 16, 2022 at 7:02 AM Arthur Fuller <fuller.artful at gmail.com>
wrote:

> I'm a little puzzled by this error, especially since I copied the sub from
> Microsoft Learn.
>
> <code>
> Sub DatabaseObjectX()
>
>  Dim wrkAcc As Workspace
>  Dim dbsNorthwind As Database
>  Dim dbsNew As Database
>  Dim dbsLoop As Database
>  Dim prpLoop As Property
>
>  Set wrkAcc = CreateWorkspace("AccessWorkspace", "admin", _
>     "", dbUseJet)
>
>  ' Make sure there isn't already a file with the name of
>  ' the new database.
>  If Dir("NewDB.accdb") <> "" Then Kill "NewDB.accdb"
>
>  ' Create a new database with the specified
>  ' collating order.
>  Set dbsNew = wrkAcc.CreateDatabase("NewDB.accdb", _
>     dbLangGeneral)
>  Set dbsNorthwind = wrkAcc.OpenDatabase(CON_NorthwindPath &
> "Northwind.accdb")
>
>  ' Enumerate the Databases collection.
>  For Each dbsLoop In wrkAcc.Databases
>     With dbsLoop
>         Debug.Print "Properties of " & .Name
>         ' Enumerate the Properties collection of each
>         ' Database object.
>         For Each prpLoop In .Properties
>            ' the line below causes the error
>             If prpLoop <> "" Then Debug.Print " " & _
>                 prpLoop.Name & " = " & prpLoop
>         Next prpLoop
>     End With
>  Next dbsLoop
>
>  dbsNew.Close
>  dbsNorthwind.Close
>  wrkAcc.Close
>
> End Sub
> </code>
> The error message says "Operation not supported for this type of object."
>
> Any idea why?
>
> --
> Arthur
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> https://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>


-- 
John W. Colby
Colby Consulting


More information about the AccessD mailing list