[AccessD] Operation Not Supported...
Stuart McLachlan
stuart at lexacorp.com.pg
Sun Oct 16 15:19:00 CDT 2022
That's not the issue. The Property Value is the default.
Athur's code works fine for most properties. It is crashing when it reached a property with
Type of "0". That's probably the "Connection" property
He needs something like
Debug.Print prploop.Name, prploop.Type, IIf(prploop.Type = 0, "No Value", prploop)
On 16 Oct 2022 at 16:02, Gustav Brock via AccessD wrote:
> Hi Arthur
>
> A DAO.Property is an object. That can´t be compared to an empty
> string. Try with .Name or .Value of prploop.
>
> /gustav
>
> Fra: Arthur Fuller<mailto:fuller.artful at gmail.com>
> Sendt: 16. oktober 2022 15:26
> Til: Access Developers discussion and problem
> solving<mailto:accessd at databaseadvisors.com> Emne: Re: [AccessD]
> Operation Not Supported...
>
> I added an error handler, which gives the same result as I mentioned:
>
> Error 3251: Operation is not supported for this type of object.
>
> In the code I provided, there is a comment on the line above the
> errant line.
>
> On Sun, Oct 16, 2022 at 7:35 AM John Colby <jwcolby at gmail.com> wrote:
>
> > 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
>
More information about the AccessD
mailing list