|
-
Apr 22nd, 2001, 12:18 PM
#1
Thread Starter
New Member
This is a very simple question yet I don't seem to be able to work it out. I have conected to a database using an adodb conection. All I want to do is to be able to display the table names in that database on a form.
-
Apr 22nd, 2001, 12:42 PM
#2
Monday Morning Lunatic
What sort of database are you using?
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Apr 22nd, 2001, 01:45 PM
#3
Thread Starter
New Member
Access 2000 using Jet 4.0
-
Apr 22nd, 2001, 03:11 PM
#4
Monday Morning Lunatic
Not sure if this is totally legal, but it works on Access 2000 
Code:
Dim x As New Recordset
x.Open "SELECT [Name] FROM MSysObjects WHERE [Type]=4;", CurrentProject.Connection, adOpenDynamic, adLockReadOnly
x.MoveFirst
While Not x.EOF
Debug.Print x!Name
x.MoveNext
Wend
x.Close
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Apr 22nd, 2001, 05:16 PM
#5
Thread Starter
New Member
Thanks for that, have just tried it but I'm getting an error.
Record(s) can't be read; no permission on 'MSysObjects'
-
Apr 22nd, 2001, 05:35 PM
#6
Monday Morning Lunatic
Bugger 
The reason that worked for me was probably because I did that inside Access, due to the fact that I haven't managed to get round to reinstalling VB yet What user are you logging on as?
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Apr 22nd, 2001, 05:44 PM
#7
Thread Starter
New Member
I'm logged on as Admin
It's a real pain you would have thought there would be some straight forward way of seeing the table names.
-
Apr 22nd, 2001, 06:21 PM
#8
Monday Morning Lunatic
I couldn't find anything in the documentation about it *grr* *grr*
Most RDBMSs have a SQL statement that returns a recordset with the table names in, equivalent to MySQL's "SHOW TABLES;" statement.
I expect there *is* a method...they're just keeping quiet about it Maybe a look on the MS Knowledge Base might be productive.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Apr 22nd, 2001, 06:37 PM
#9
PowerPoster
Try this:
Add a listbox called "lstTables" to a form. Add a reference to Microsoft DAO 3.6 Object Library (or whichever version you have the latest of) and paste this code into the Form_Load event.
Code:
Dim dbTest As Database
Set dbTest = OpenDatabase("MyDB.mdb", False, False, ";pwd=" & "MyPassword")
Dim tblObj As DAO.TableDef
Dim intI As Integer
lstTables.Clear
For Each tblObj In dbTest.TableDefs
If UCase(Left(tblObj.Name, 4)) <> "MSYS" Then
lstTables.AddItem tblObj.Name
End If
Next
dbTest.Close
-
Apr 22nd, 2001, 06:52 PM
#10
Monday Morning Lunatic
Oh well...I was trying to avoid DAO but it seems there's no way round it It's Access 2000 so it needs to be 3.6 or later.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Apr 22nd, 2001, 06:58 PM
#11
PowerPoster
Originally posted by parksie
Oh well...I was trying to avoid DAO but it seems there's no way round it.
It works, I use it. Nuff said.
It's Access 2000 so it needs to be 3.6 or later.
He might have the pre-release 3.7 (you never know, could happen).
-
Apr 22nd, 2001, 08:08 PM
#12
Thread Starter
New Member
I've just tried that and it works fine.
Thanks very much for everybodies help.
-
Apr 22nd, 2001, 08:18 PM
#13
PowerPoster
Good ol' DAO wins round one
-
May 20th, 2002, 01:19 PM
#14
Didn't anyone write about ADOX?
HI there,
I don't subscribe to the view abotu using DAO. You could use ADOX just as effectively.
Cheers!
Abhijit
Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
save a blobFileStreamDataTable To Text Filemy blog
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
|