[AccessD] ADO Create TableDef

MartyConnelly martyconnelly at shaw.ca
Mon Sep 19 17:23:10 CDT 2005


If you download the  Microsoft Data Access Components (MDAC) 2.8 
Software Development Kit SDK or the 2.6 one
http://www.microsoft.com/downloads/details.aspx?FamilyID=5067faf8-0db4-429a-b502-de4329c8c850&DisplayLang=en

It should contain this ms ado help file
"C:\Program Files\Microsoft Data Access SDK\Docs\ado260.chm"

Boatloads of sample vb code to do most of this in the help file.

or try here , you might want to sign up for rod stephens news letter too.

http://www.vb-helper.com/index_database.html#ado

Jeremy Toves wrote:

>Thanks!  I'll try that.  
>
>Jeremy
> 
>
>
>Charlotte Foust <cfoust at infostatsystems.com> wrote:
>I don't know exactly what it is you want to do, but here is an example
>of how to create a table using ADOX.
>
>Public Function CreateTableADO() 
>Dim tbl As ADOX.Table
>Dim cat As ADOX.Catalog
>
>' Open the Catalog.
>Set cat = New ADOX.Catalog
>cat.ActiveConnection = CurrentProject.Connection
>Set tbl = New ADOX.Table
>With tbl
>.Name = "MyTable"
>.Columns.Append "Column1", adInteger
>.Columns.Append "Column2", adInteger
>.Columns.Append "Column3", adVarWChar, 50
>End With
>cat.Tables.Append tbl
>Set tbl = Nothing
>Set cat = Nothing
>End Function
>
>Charlotte Foust
>
>
>-----Original Message-----
>From: Jeremy Toves [mailto:itsame2000 at sbcglobal.net] 
>Sent: Monday, September 19, 2005 12:09 PM
>To: AccessD
>Subject: [AccessD] ADO Create TableDef
>
>
>I've worked with DAO for so long, I'm finally taking the plunge into
>ADO. I have a database that pulls up records I need from an Oracle
>database. No issues there. What I want to do now is make a dynamic
>output table to push all my results to. I may be going about this the
>wrong way. Does anybody have suggestions? 
>
>Thanks,
>Jeremy Toves
>
>
>
>*************************************
>
>
>Sub PullRecords()
>Dim rs As Recordset
>Dim cn As Connection
>Dim strCn As String, strSQL As String
>Dim intX As Integer, intFieldCnt As Integer
>
>strCn = "ODBC; " _
>& "Provider=MSDASQL.1; " _
>& "Driver=Oracle ODBC Driver; " _
>& "DBQ=tns_name; " _
>& "UID=username; " _
>& "PWD=password;"
>
>strSQL = "SELECT " _
>& "TableName.* " _
>& "FROM " _
>& "TableName " _
>& "WHERE " _
>& "TableName.Fieldname Like " & Chr(39) & "1234%" & Chr(39)
>& ";"
>
>Set cn = New Connection
>cn.ConnectionString = strCn
>cn.Open
>Debug.Print cn.ConnectionString
>Set rs = cn.Execute(strSQL)
>
>intFieldCnt = rs.Fields.Count
>
>For intX = 0 To intFieldCnt - 1
>Debug.Print rs.Fields(intX).Name & ": " & rs(intX)
>
>========>> I want to create a table based on the columns I pull
>here. I'd like it to be dynamic allowing me to reuse the same process
>to output the result of different source tables. Ideas? <<========
>
>Next 
>
>rs.Close
>cn.Close
>End Sub
>  
>

-- 
Marty Connelly
Victoria, B.C.
Canada






More information about the AccessD mailing list