|
-
Jun 4th, 2002, 09:59 PM
#1
Thread Starter
Lively Member
extracting tables from database and variables.
when using this code below that i found on this board, i want it to display the tables that are inside the database and add these to a combo box, which it does but it also adds these to the combo box:
MSysAccessObjects
MSysAccessXML
MSysACEs
MSysObjects
MSysQueries
MSysRelationships
is there any way to make it so that these aren't shown in the database?
Access xp and vb 6 sp5.
Code:
'Add a reference to Microsoft ADO Ext. X.X For DLL And Security
'Add a reference to Microsoft ActiveX Data Objects X.X Library
Option Explicit
Private cat As ADOX.Catalog
Private tbl As ADOX.Table
Private cnn As New ADODB.Connection
Private Sub Form_Load()
Set cat = New ADOX.Catalog
Set tbl = New ADOX.Table
'setup db connection
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Jonathon Vantuyl\Desktop\Roster Manager\jv football.mdb"
Set cat.ActiveConnection = cnn
'loop through all tables, and all fields in each table.
For Each tbl In cat.Tables
cmbRecordSource.AddItem tbl.Name
Next tbl
'close the connection
cnn.Close
Set cnn = Nothing
End Sub
Also:
is it possible to make it run of from a global variable. i attempt just like replasing the location with the variable name and then it says it cant find the file (but adds the location extension, so its like.......C:\Documents and Settings\Jonathon Vantuyl\Desktop\Roster Manager\database). database is the variables name.
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Jonathon Vantuyl\Desktop\Roster Manager\jv football.mdb"
One More:
once the database is selected, and then the table, how do i add the colums (fields or whatever they are called) to a list box?
thanks much
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|