Solved

DAO to ADO Tabledef Code

Posted on 2004-04-29
6
1,207 Views
Last Modified: 2008-02-01
I need to convert some DAO code to ADO.  How do I access tabledef info?  Below is how I did it using DAO:

Private Sub cboTables_Enter()
    Dim tdf As TableDef
    Dim strOutput As String
   
    dbMCL.TableDefs.Refresh
    For Each tdf In dbMCL.TableDefs
        strOutput = strOutput & ";" & tdf.Name
    Next tdf
    strOutput = Mid(strOutput, 2)
    Me.cboTables.RowSource = strOutput
End Sub
0
Comment
Question by:schmir1
  • 3
  • 3
6 Comments
 
LVL 34

Expert Comment

by:arbert
ID: 10954060
Use this as a query and then act upon the recordset:  select * from information_schema.tables
0
 

Author Comment

by:schmir1
ID: 10954763
I'm afraid I don't understand your answer.  

I did find a way to do what I want using AccessObject as follows:

Private Sub cboTables_Enter()
'List all tables in the tables section
  Dim strOutput As String
  Dim obj As AccessObject
  Dim dbs As Object
 
  Set dbs = Application.CurrentData
 
  For Each obj In dbs.AllTables
    'Filter out the system tables
    If InStr(1, obj.Name, "sys", vbTextCompare) = 0 Then
     strOutput = strOutput & ";" & obj.Name
    End If
  Next obj
 
  strOutput = Mid(strOutput, 2)
  Me!cboTables.RowSource = strOutput
End Sub
0
 
LVL 34

Expert Comment

by:arbert
ID: 10955130
I guess I didn't understand your question then--do you not want to get away from Access objects and use ADO?
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:schmir1
ID: 10960758
Looks like Access Objects work with SQL.  Does your way have advantages?  If so, can you give me more detail as to how I would use it (understanding that I don't know anything about information_schema.tables
0
 

Author Comment

by:schmir1
ID: 11153235
arbert

Do you have any farther input?  It will probably be useful to me to understand your answer (and exept it as an answer) even if I don't use it in this particular case.  

You wouldn't know anything about replication(-:.  I've have opened another question just begging for an answer.
0
 
LVL 34

Accepted Solution

by:
arbert earned 500 total points
ID: 11156920
information_schema views allow access to the SQL Server system tables and return structure information about your tables and you can also get information on your stored procs and views....

Brett
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Live Storage Vmotion VMs with shared VMDK 10 56
SSRS 2012 r2 - Parm Drop Down has Date/Time 12 31
Find SQL query used by application 3 17
SQL Improvement  ( Speed) 14 26
Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question