How to convert DAO to ADO

L

Lucky

I need to create in ADO function that works like
DoesObjectExist (Microsoft Knowledge Base Article -
210598).

I can get through tables (simple, TableDef is Tables in
ADO), after that I am stuck in finding corresponding ADO
values/parameters for QueryDef, etc.

Example:
Case "Queries"
For Each qry In dbs.QueryDefs
If qry.Name = objName Then
objExists = True
Exit Function
End If
Next qry

How do I convert this and similar code for forms,
reports, modules to ADO?

Your help or ideas are greatly appreciated.

Lucky
 
D

Douglas J. Steele

ADO is a data access protocol. It doesn't know anything about Forms, Reports
or Modules.

What you can do is look at the AllForms, AllReports, All Macros and
AllModules collections which are part of the Access.CurrentProject object.
You can also look at the AllTables and AllQueries collections which are part
of the Access.CurrentData object.
 
S

Steve King

TableDef is NOT ADO but DAO. Use SysCmd or
CurrentData.AllQueries

SysCmd(acSysCmdGetObjectState, acForm, "Switchboard") = 1

If Len(Application.CurrentData.AllQueries(QueryName).Name)

Steve King
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top