Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / February 2005

Tip: Looking for answers? Try searching our database.

OpenTable restricted/unsupported?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ennex - 28 Feb 2005 22:07 GMT
Okay, Dan Artuso informed me that Dynaset is obsolete, so I've removed it
from my code. Also, an MS Web page tells me that the Table object is found in
the "ADO Ext. for DDL and Security" reference, so I've selected that. So my
errors on Dynaset and Table objects have gone away. Thank you.

Now attempting to compile gives:
    "Compile Error:
        Function or interface marked as restricted,
        or the function uses an Automation type
        not supported in Visual Basic",
    highlighting ".OpenTable" in the statement
    "Set AffilsTable = EnnexDB.OpenTable("Affiliations")"

EnnexDB is declared at the top of the module by:
    "Dim EnnexDB As Database"
and is defined in the function by:
    "Set EnnexDB = CurrentDb"

Can you tell me what's wrong with my use of the OpenTable property here? It
used to work in Access 2000.

Thank you for your help.

(Using Access 2003 under Win XP Pro on a Dell Inspiron 600m.)

Regards,
Marshall Burns
www.Ennex.com
Dirk Goldgar - 28 Feb 2005 22:29 GMT
> Okay, Dan Artuso informed me that Dynaset is obsolete, so I've
> removed it from my code. Also, an MS Web page tells me that the Table
[quoted text clipped - 25 lines]
> Marshall Burns
> www.Ennex.com

If it worked in Access 2000, presumably it was because you had a
reference set to the DAO 2.5/3.5 Compatibility Library.  That code has
been deprecated since Access 95.  To make your code work, you must do
one of two things:  (a) change the code to use DAO 3.6 constructs, or
(b) reinstate the reference to the compatibility library.  In either
case, you do not want the reference to ADOX (that is, "ADO Ext. for DDL
and Security" ).

In DAO 3.5 and later, there is no Table object -- it's just another type
of recordset.  With a reference set to DAO 3.6, as is normal for Access
2003, your code would be

   Dim EnnexDB As DAO.Database
   Dim AffilsTable As DAO.Recordset

   Set EnnexDB = CurrentDb
   Set AffilsTable = EnnexDB.OpenRecordset("Affiliations")

Signature

Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

George Nicholson - 28 Feb 2005 22:34 GMT
> Can you tell me what's wrong with my use of the OpenTable property here?
> It
> used to work in Access 2000.
I very seriously doubt that it worked in Access 2000.  DAO Database does not
have an OpenTable property or event (and ADO doesn't have a Database
object).  Neither of these object models have changed that much (if at all)
between 2000 and 2003.

DoCmd has an OpenTable method, but it doesn't set an object. Just opens a
table.

Maybe you are thinking CurrentDB.OpenRecordset("mytablename") or
CurrentDB.TableDefs("Affiliations"). Hard to say since you don't provide a
clue as to what you are trying to do.

>Also, an MS Web page tells me that the Table object is found in
> the "ADO Ext. for DDL and Security" reference, so I've selected that.

Yeah, but I seriously doubt that it's the kind of table you are looking for.
Uncheck this reference. Make sure "Microsoft DAO x.x" is checked.

Dim EnnexDB As DAO.Database
Dim AffilsTable as DAO.Recordset

Set EnnexDB = CurrentDB
Set AffilsTable = EnnexDB.OpenRecordset("Affiliations")"

?or, maybe?
Dim AffilsTable as DAO.TableDef

Set AffilsTable = EnnexDB.TableDefs("Affiliations")"

HTH,
Signature

George Nicholson

Remove 'Junk' from return address.

> Okay, Dan Artuso informed me that Dynaset is obsolete, so I've removed it
> from my code. Also, an MS Web page tells me that the Table object is found
[quoted text clipped - 27 lines]
> Marshall Burns
> www.Ennex.com 
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.