Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Retreiving list of table & field names from Access into Excel using VBA


I am using VBA in MS Excel to create tables in MS Access and se
relationships between the tables as I have large amounts of relate
data. Now in order to do that, I need to know how to list the names o
the tables and fields in the tables in the database. This would help m
to choose tables and further choose fields in those tables to se
relationships between them. How do I do that? Please help.

Peace,

Shivbo

--
shivbo
-----------------------------------------------------------------------
shivboy's Profile: http://www.excelforum.com/member.php...fo&userid=3513
View this thread: http://www.excelforum.com/showthread.php?threadid=55160

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Retreiving list of table & field names from Access into Excel usin

two approaches:

http://tinyurl.com/fpvvr

http://tinyurl.com/p45cj



--
Regards,
Tom Ogilvy

"shivboy" wrote:


I am using VBA in MS Excel to create tables in MS Access and set
relationships between the tables as I have large amounts of related
data. Now in order to do that, I need to know how to list the names of
the tables and fields in the tables in the database. This would help me
to choose tables and further choose fields in those tables to set
relationships between them. How do I do that? Please help.

Peace,

Shivboy


--
shivboy
------------------------------------------------------------------------
shivboy's Profile: http://www.excelforum.com/member.php...o&userid=35137
View this thread: http://www.excelforum.com/showthread...hreadid=551602


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Retreiving list of table & field names from Access into Excel using VBA


Tom, thanks a ton for the help. But there is still a small issue I a
facing with the output.

Everytime the code retrieves the table names, it also retrieves th
following tables as well:

MSysAccessObjects
MSysACEs
MSysObjects
MSysQueries
MSysRelationships

What do I do to avoid displaying these tables as the output?

Please help on this one too.

Peace,

Shivboy
Tom Ogilvy Wrote:
two approaches:

http://tinyurl.com/fpvvr

http://tinyurl.com/p45cj



--
Regards,
Tom Ogilvy

"shivboy" wrote:


I am using VBA in MS Excel to create tables in MS Access and set
relationships between the tables as I have large amounts of related
data. Now in order to do that, I need to know how to list the name

of
the tables and fields in the tables in the database. This would hel

me
to choose tables and further choose fields in those tables to set
relationships between them. How do I do that? Please help.

Peace,

Shivboy


--
shivboy


------------------------------------------------------------------------
shivboy's Profile

http://www.excelforum.com/member.php...o&userid=35137
View this thread

http://www.excelforum.com/showthread...hreadid=551602



--
shivbo
-----------------------------------------------------------------------
shivboy's Profile: http://www.excelforum.com/member.php...fo&userid=3513
View this thread: http://www.excelforum.com/showthread.php?threadid=55160

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Retreiving list of table & field names from Access into Excel using VBA

Try code like the following. Set a reference to DAO 3.6 and run
the following code:

Sub AAA()
Dim DB As DAO.Database
Dim Tbl As DAO.TableDef
Dim Rng As Range
Dim Fld As DAO.Field
Set Rng = Range("A1")
Set DB = DAO.OpenDatabase("H:\Test\Test.mdb")'<<< CHANGE

For Each Tbl In DB.TableDefs
If Tbl.Attributes = 0 Then
Rng.Value = Tbl.Name
Set Rng = Rng(2, 2)
For Each Fld In Tbl.Fields
Rng.Value = Fld.Name
Set Rng = Rng(2, 1)
Next Fld
Set Rng = Rng(1, 0)

End If
Next Tbl
DB.Close
End Sub

"shivboy"
wrote in message
...

I am using VBA in MS Excel to create tables in MS Access and
set
relationships between the tables as I have large amounts of
related
data. Now in order to do that, I need to know how to list the
names of
the tables and fields in the tables in the database. This would
help me
to choose tables and further choose fields in those tables to
set
relationships between them. How do I do that? Please help.

Peace,

Shivboy


--
shivboy
------------------------------------------------------------------------
shivboy's Profile:
http://www.excelforum.com/member.php...o&userid=35137
View this thread:
http://www.excelforum.com/showthread...hreadid=551602



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Retreiving list of table & field names from Access into Excel using VBA


Hi Chip,

Thanks for the code, but my problem still persists. The tables listed
above still appear in addition to the tables created by me. What do I
do?

Peace,

Shivboy

Chip Pearson Wrote:
Try code like the following. Set a reference to DAO 3.6 and run
the following code:

Sub AAA()
Dim DB As DAO.Database
Dim Tbl As DAO.TableDef
Dim Rng As Range
Dim Fld As DAO.Field
Set Rng = Range("A1")
Set DB = DAO.OpenDatabase("H:\Test\Test.mdb")'<<< CHANGE

For Each Tbl In DB.TableDefs
If Tbl.Attributes = 0 Then
Rng.Value = Tbl.Name
Set Rng = Rng(2, 2)
For Each Fld In Tbl.Fields
Rng.Value = Fld.Name
Set Rng = Rng(2, 1)
Next Fld
Set Rng = Rng(1, 0)

End If
Next Tbl
DB.Close
End Sub

"shivboy"
wrote in message
...

I am using VBA in MS Excel to create tables in MS Access and
set
relationships between the tables as I have large amounts of
related
data. Now in order to do that, I need to know how to list the
names of
the tables and fields in the tables in the database. This would
help me
to choose tables and further choose fields in those tables to
set
relationships between them. How do I do that? Please help.

Peace,

Shivboy


--
shivboy

------------------------------------------------------------------------
shivboy's Profile:
http://www.excelforum.com/member.php...o&userid=35137
View this thread:
http://www.excelforum.com/showthread...hreadid=551602



--
shivboy
------------------------------------------------------------------------
shivboy's Profile: http://www.excelforum.com/member.php...o&userid=35137
View this thread: http://www.excelforum.com/showthread...hreadid=551602

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
Rename imported MS Access field names Ron Excel Discussion (Misc queries) 1 May 7th 09 05:17 PM
Excel Spreadsheet from Access. List of names changes as names are Gordy w/Hi Expectations Excel Discussion (Misc queries) 1 October 21st 05 03:30 AM
Fetch list of table names in access to a record set Prashantha Weerakoon Excel Programming 1 May 6th 05 12:26 PM
Get table names from access through vba in excel Danny Excel Programming 3 August 24th 04 10:16 AM
retrieving table names from Excel and Access sources using ADO masayoshi hayashi Excel Programming 3 December 10th 03 09:35 AM


All times are GMT +1. The time now is 11:23 AM.

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"