Solved

DAO to ADO Tabledef Code

Posted on 2004-04-29
6
1,216 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

 

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

Backup Solution for AWS

Read about how CloudBerry Backup fully integrates your backups with Amazon S3 and Amazon Glacier to provide military-grade encryption and dramatically cut storage costs on any platform.

Question has a verified solution.

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

When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

726 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