How to convert DAO to ADO

  • Thread starter Thread starter Lucky
  • Start date Start date
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
 
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.
 
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
 
Back
Top