Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 4
Default Returning Access Table properties to Excel

Hi,

I have the following code which does what i need , except it returns the
values to the debug window.

Sub Table_properties()

Dim cat As New ADOX.Catalog
Dim tbl As ADOX.Table
Dim clm As ADOX.Column


cat.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\database.mdb"

For Each tbl In cat.Tables
Debug.Print "Table: " & " " & tbl.Name, tbl.Type

For Each clm In tbl.Columns
Debug.Print clm.Name, clm.Type,
clm.DefinedSize
Next
Next tbl
End Sub

If i had a recordset I could use :

While not myRS.EOF
i = i + 1
ws.[a1].cells(i) = MyRS ...
MyRS.movenext
Wend




I need to return this data somehow into excel,

Does anyone have any ideas please ?

Thanks


  #2   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 2,979
Default Returning Access Table properties to Excel

Something like this:

Sub Table_properties()

Dim cat As New ADOX.Catalog
Dim tbl As ADOX.Table
Dim clm As ADOX.Column
Dim lRow As Long

cat.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\database.mdb"
lRow = 0

For Each tbl In cat.Tables
For Each clm In tbl.Columns
lRow = lRow + 1
With ActiveSheet
.Cells(lRow, 1).Value = tbl.Name
.Cells(lRow, 2).Value = tbl.Type
.Cells(lRow, 3).Value = clm.Name
.Cells(lRow, 4).Value = clm.Type
.Cells(lRow, 5).Value = clm.DefinedSize
End With
Next
Next tbl
End Sub


James wrote:
Hi,

I have the following code which does what i need , except it returns the
values to the debug window.

Sub Table_properties()

Dim cat As New ADOX.Catalog
Dim tbl As ADOX.Table
Dim clm As ADOX.Column


cat.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\database.mdb"

For Each tbl In cat.Tables
Debug.Print "Table: " & " " & tbl.Name, tbl.Type

For Each clm In tbl.Columns
Debug.Print clm.Name, clm.Type,
clm.DefinedSize
Next
Next tbl
End Sub

If i had a recordset I could use :

While not myRS.EOF
i = i + 1
ws.[a1].cells(i) = MyRS ...
MyRS.movenext
Wend




I need to return this data somehow into excel,

Does anyone have any ideas please ?

Thanks




--
Debra Dalgleish
Contextures
http://www.contextures.com/tiptech.html

  #3   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 4
Default Returning Access Table properties to Excel

Thanks Debra you are a star - thats exactly what i was looking for!

Regards
J
"Debra Dalgleish" wrote in message
...
Something like this:

Sub Table_properties()

Dim cat As New ADOX.Catalog
Dim tbl As ADOX.Table
Dim clm As ADOX.Column
Dim lRow As Long

cat.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\database.mdb"
lRow = 0

For Each tbl In cat.Tables
For Each clm In tbl.Columns
lRow = lRow + 1
With ActiveSheet
.Cells(lRow, 1).Value = tbl.Name
.Cells(lRow, 2).Value = tbl.Type
.Cells(lRow, 3).Value = clm.Name
.Cells(lRow, 4).Value = clm.Type
.Cells(lRow, 5).Value = clm.DefinedSize
End With
Next
Next tbl
End Sub


James wrote:
Hi,

I have the following code which does what i need , except it returns the
values to the debug window.

Sub Table_properties()

Dim cat As New ADOX.Catalog
Dim tbl As ADOX.Table
Dim clm As ADOX.Column


cat.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\database.mdb"

For Each tbl In cat.Tables
Debug.Print "Table: " & " " & tbl.Name, tbl.Type

For Each clm In tbl.Columns
Debug.Print clm.Name, clm.Type,
clm.DefinedSize
Next
Next tbl
End Sub

If i had a recordset I could use :

While not myRS.EOF
i = i + 1
ws.[a1].cells(i) = MyRS ...
MyRS.movenext
Wend




I need to return this data somehow into excel,

Does anyone have any ideas please ?

Thanks




--
Debra Dalgleish
Contextures
http://www.contextures.com/tiptech.html



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
returning offset row from excel table destrolennox Excel Discussion (Misc queries) 4 July 18th 06 10:58 PM
Open an Access table in Excel ray_johnson Excel Discussion (Misc queries) 0 May 12th 06 06:01 PM
How to retrieve the value within the table from Access into Excel? Eric Excel Discussion (Misc queries) 1 April 18th 06 09:19 PM
Excel Pivot Table with Access ExcelQuestions Excel Discussion (Misc queries) 0 April 11th 05 03:37 PM
How can I access/display File -> properties in a cell Denny Excel Discussion (Misc queries) 1 March 4th 05 02:22 PM


All times are GMT +1. The time now is 02:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"