PC Review


Reply
Thread Tools Rate Thread

Listing tables from different DB

 
 
Del
Guest
Posts: n/a
 
      9th Jul 2008
I'm using Access 2000 and I want to fill a combo box list with the tables
from another database so my user can select which table to import.
--
Thank you,
Del
 
Reply With Quote
 
 
 
 
fredg
Guest
Posts: n/a
 
      9th Jul 2008
On Tue, 8 Jul 2008 15:10:02 -0700, Del wrote:

> I'm using Access 2000 and I want to fill a combo box list with the tables
> from another database so my user can select which table to import.



Let's assume the combo box name is "cboTableList".
Set the Combo box's RowsourceType property to Value List.
Leave the Rowsource blank.

Paste the following into a new module.

Function GetDiffDbTableNames()
Dim wrkJet As Workspace
Dim Db As DAO.Database
Dim tdf As TableDef
Dim strList As String
Set wrkJet = CreateWorkspace("", "admin", "", dbUseJet)

Set Db = wrkJet.OpenDatabase("c:\MyFolder\MyDatabaseName.mdb", False)

For Each tdf In Db.TableDefs
If Left(tdf.Name, 4) <> "MSys" Then
strList = strList & tdf.Name & ","
End If

Next
strList = Left(strList, Len(strList) - 1)
GetDiffDbTableNames = strList
Set Db = Nothing
wrkJet.Close
End Function
------------------
Code the Form's Load event:

Me.cboTableList.RowSource = GetDiffDbTableNames



--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Listing hidden tables Nando Microsoft Access VBA Modules 1 17th Jul 2008 07:51 AM
RE: Splitting Out a listing tables Duane Hookom Microsoft Access Queries 2 12th May 2008 11:22 PM
Listing tables, then loop through data Hugh Janus Microsoft Dot NET Compact Framework 1 10th Apr 2008 10:42 AM
How can I get a listing of all tables in Access =?Utf-8?B?ZGM=?= Microsoft Access 4 4th Nov 2004 02:17 PM
Listing tables of database AnandVishy Microsoft C# .NET 1 5th Dec 2003 01:53 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:05 PM.