Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Rename imported MS Access field names | Excel Discussion (Misc queries) | |||
Excel Spreadsheet from Access. List of names changes as names are | Excel Discussion (Misc queries) | |||
Fetch list of table names in access to a record set | Excel Programming | |||
Get table names from access through vba in excel | Excel Programming | |||
retrieving table names from Excel and Access sources using ADO | Excel Programming |