473,396 Members | 1,816 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

list of tables in mdb file

Hi,
is there a way to get a list of tables in MDB file? Ideally I want to
write an SQL similar to
'select * from tab' of oracle.

Aug 14 '06 #1
5 14060
Hi Javed,

I don't know of any way that you can get all the table names in SQL,
however it is quite easy in VBA.

' Will build a list of tables that be safely deleted
Public Sub BuildTableList()
Dim strTable As String
Dim rs As New ADODB.Recordset
Dim sql As String
Dim intTables As Integer
Dim varLoopVar As Variant
sql = "DELETE * FROM tblTable"
With DoCmd
.SetWarnings False
.RunSQL sql
.SetWarnings True
End With
sql = _
"SELECT TableName " & _
"FROM tblTable"
rs.Open sql, CurrentProject.AccessConnection, adOpenDynamic,
adLockOptimistic
For Each varLoopVar In CurrentData.AllTables
strTable = varLoopVar.Name
With rs
.AddNew
!TableName = strTable
.Update
End With
Next
Set rs = Nothing
End Sub

This code will delete everything from tblTable and insert the name of
every table contained within the current database.

Good luck

Nick

Javed wrote:
Hi,
is there a way to get a list of tables in MDB file? Ideally I want to
write an SQL similar to
'select * from tab' of oracle.
Aug 14 '06 #2
Thanks Nice. That helps

- Javed.

Nick 'The database Guy' wrote:
Hi Javed,

I don't know of any way that you can get all the table names in SQL,
however it is quite easy in VBA.

' Will build a list of tables that be safely deleted
Public Sub BuildTableList()
Dim strTable As String
Dim rs As New ADODB.Recordset
Dim sql As String
Dim intTables As Integer
Dim varLoopVar As Variant
sql = "DELETE * FROM tblTable"
With DoCmd
.SetWarnings False
.RunSQL sql
.SetWarnings True
End With
sql = _
"SELECT TableName " & _
"FROM tblTable"
rs.Open sql, CurrentProject.AccessConnection, adOpenDynamic,
adLockOptimistic
For Each varLoopVar In CurrentData.AllTables
strTable = varLoopVar.Name
With rs
.AddNew
!TableName = strTable
.Update
End With
Next
Set rs = Nothing
End Sub

This code will delete everything from tblTable and insert the name of
every table contained within the current database.

Good luck

Nick

Javed wrote:
Hi,
is there a way to get a list of tables in MDB file? Ideally I want to
write an SQL similar to
'select * from tab' of oracle.
Aug 14 '06 #3
"Javed" <ja******@gmail.comwrote in message
<11*********************@i3g2000cwc.googlegroups.c om>:
Hi,
is there a way to get a list of tables in MDB file? Ideally I want to
write an SQL similar to
'select * from tab' of oracle.
I don't know anything about Oracle, but you can get a list of tables
in an mde through something like

SELECT Name
FROM MSysObjects
WHERE Type In (1,4,6) AND Left([Name],4)<>"MSYS";

Where type = 1 denotes native Access tables.

--
Roy-Vidar
Aug 14 '06 #4
Hi Roy,

How silly of me to forget about the MSysObjects table.

However I would update the SQL to, please see below, that will also
avoid temporary tables as well as system tables appearing on the list.

Thanks for the reminder.

Nick

SELECT MSysObjects.Name
FROM MSysObjects
WHERE (((MSysObjects.Type) In (1,4,6)) AND ((Left([Name],4))<>"MSYS")
AND ((Left([Name],1))<>"~"));

RoyVidar wrote:
"Javed" <ja******@gmail.comwrote in message
<11*********************@i3g2000cwc.googlegroups.c om>:
Hi,
is there a way to get a list of tables in MDB file? Ideally I want to
write an SQL similar to
'select * from tab' of oracle.

I don't know anything about Oracle, but you can get a list of tables
in an mde through something like

SELECT Name
FROM MSysObjects
WHERE Type In (1,4,6) AND Left([Name],4)<>"MSYS";

Where type = 1 denotes native Access tables.

--
Roy-Vidar
Aug 15 '06 #5
Javed wrote:
Hi,
is there a way to get a list of tables in MDB file? Ideally I want to
write an SQL similar to
'select * from tab' of oracle.
Is this for Oracle? FWIW, you can run select * from tab via a pass
through query. You'll get a listing of tables, abtype and clusterID for
all tables and views that were created in the user ID in which your DSN
was created.

--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Aug 15 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: tom | last post by:
I am new to SQL administration. >From a list of IDs that are the primary key in one table (i.e. Customer Table), I want to make changes in tables that use those IDs as a foreign key. ...
11
by: Madison Kelly | last post by:
Hi all, I am new to the list and I didn't want to seem rude at all so I wanted to ask if this was okay first. I have a program I have written in perl which uses a postgresSQL database as the...
5
by: Lee Brotzman | last post by:
Hi, I have a sequence of data tables in an ordered list, like this: <ol> <li><table></table></li> <li><table></table></li> </ol> However it renders on the page with the list item number...
3
by: grzegorz.gazda | last post by:
Hi all Is there any limit of images which can be added to a image list. I have a problem with this control. I added an image list in design mode and I am adding images using code. Then I want to...
2
by: G Gerard | last post by:
Hello I am trying to connect to a msaccess database and then create a list of the objects in that database (more specifically the tables) and then create a list of the fields (including the...
2
by: Lysander | last post by:
I have not seen this feature documented before, so I thought I would share it with you, as I will be using it in a later article. For a combo or list box, the source data is normally a...
0
by: slinky | last post by:
Thanks in advance for for any clues: I have a website I'm building using MS-Visual Web Developer Express (Asp.Net/VB.net). I'm tooling it to collect names and emails to send out our newsletter. I...
2
by: slinky | last post by:
Thanks in advance for for any clues: I have a website I'm building using MS-Visual Web Developer Express (Asp.Net/VB.net). I'm tooling it to collect names and emails to send out our newsletter. I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.