473,757 Members | 2,081 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 14077
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. AccessConnectio n, adOpenDynamic,
adLockOptimisti c
For Each varLoopVar In CurrentData.All Tables
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. AccessConnectio n, adOpenDynamic,
adLockOptimisti c
For Each varLoopVar In CurrentData.All Tables
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************ *********@i3g20 00cwc.googlegro ups.com>:
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.Nam e
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************ *********@i3g20 00cwc.googlegro ups.com>:
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
4336
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. Basically I want to say: If fk_ID is in list then do these statements to that record
11
2290
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 backend. The program works but the performance is really bad. I have been reading as much as I can on optimizing performance but still it isn't very reasonable. At one point I had my program able to process 175,000 records in 16min 10sec on a...
5
14198
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 next to the
3
2851
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 use images in a listview, and each time I am trying to call an image at index 15 or above I have an error stating that there isn't any object at that index. I was debbuging it and there was more there was 22 images, but only 15 I can load. Is...
2
2023
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 field type) for each table.
2
6233
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 Table/Query. Or it could be a value list, a static list of data. But what if your information is not held in a table, and it is not a static list. Examples I have used have been, “next 100 prime numbers after this one”, “Every third Friday from start of...
0
1584
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 have successfully setup an XML file with some sample names and emails. I populated this through a well functioning .aspx page that writes to the XML file and I have set up another .aspx page from which I can view the collected persons. what I need...
2
1383
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 have successfully setup an XML file with some sample names and emails. I populated this through a well functioning .aspx page that writes to the XML file and I have set up another .aspx page from which I can view the collected persons. what I...
0
9487
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10069
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9884
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9735
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7285
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5324
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3828
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2697
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.