Solved

DAO to ADO Tabledef Code

Posted on 2004-04-29
6
1,201 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
Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

 

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Viewers will learn how the fundamental information of how to create a table.

707 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now