473,956 Members | 4,483 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to get table names from ms access(mdb file) by using odbclibrary.

JS

Hi.

I am writing a c++ program get the data from mdb file using odbc
library.
By the way, I couldn't get table list from mdb file.
i goolgled it up little bit, what i found is only using the ADO(or OLE
i'm not sure) library and
"SELECT Name FROM MSysObjects WHERE Type In (1,4,6) AND Left([Name],
4)<>"MSYS" this query.
i already wrote a lot of part of this program so i don't want to
switch database library.
And the query gives "no read permission on 'MSysObjects' " error
message.

If you know how to get the table list from a mdb file by using odbc
library, please share your experience.

thank you.

Aug 8 '08 #1
2 4425
If you using odbc to a mdb file, then you MUST have jet installed, and
THEREFORE you MUST also have dao installed on your machine (in fact, out of
the box, windows xp, server 2003, vista etc DOES HAVE the jet database
engine installed by default (thus you don't need to install anything on a
windows computer to read mdb files.

here is a windows (vbs) script that displays all tables...you can use late
binding in your project, and you should little trouble getting a list of
tables using the following idea.

Set dbeng = CreateObject("D AO.DBEngine.36" )
strMdbFile = "C:\Documen ts and Settings\Lawren ce\My
Documents\Acces s\ScriptExample \MultiSelect.md b"
Set db = dbeng.OpenDatab ase(strMdbFile)
for each table in db.tabledefs
msgbox table.name
next

The above is not a vba script. Paste the above into a text document, and
then re-name the extension as .vbs. If you double click on this file...you
see it list the tables in the given mdb file..

So there is a table collection available after you open the mdb file as per
above...
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl************* ****@msn.com
Aug 9 '08 #2
On Aug 9, 3:04*am, "Albert D. Kallal" <PleaseNOOOsPAM mkal...@msn.com >
wrote:
If you using odbc to a mdb file, then you MUST have jet installed, and
THEREFORE you MUST also have dao installed on your machine (in fact, out of
the box, windows xp, server 2003, vista etc DOES HAVE the jet database
engine installed by default (thus you don't need to install anything on a
windows computer to read mdb files.

here is a windows (vbs) script that displays all tables...you can use late
binding in your project, and you should little trouble getting a list of
tables using the following idea.

Set dbeng = CreateObject("D AO.DBEngine.36" )
strMdbFile = "C:\Documen ts and Settings\Lawren ce\My
Documents\Acces s\ScriptExample \MultiSelect.md b"
Set db = dbeng.OpenDatab ase(strMdbFile)
for each table in db.tabledefs
* *msgbox table.name
next

The above is not a vba script. Paste the above into a text document, and
then re-name the extension as .vbs. If you double click on this file...you
see it list the tables in the given mdb file..

So there is a table collection available after you open the mdb file as per
above...

--
Albert D. Kallal * *(Access MVP)
Edmonton, Alberta Canada
pleaseNOOSpamKa l...@msn.com

"Paste the above into a text document, and
then re-name the extension as .vbs."

Or save file in Notepad with quotes, like:

"TableNames.VBS " (including quotes)

will save file without .TXT extension. :)

Regards,
Branislav Mihaljev
Microsoft Access MVP
Aug 13 '08 #3

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

Similar topics

0
1795
by: Schorschi | last post by:
I have an Access MDB that I have created via VB .NET, thus it is an emply database. I have an XML Schema file (.XSD) that has the schema for the database, how do I get the XML Schema into the Access MDB? I have code that loads, or seems to do so, the XML Schema into a DataSet object, but how do I update the Access MDB with this DataSet Object? A code example if you please.
29
3733
by: Mark B | last post by:
We have an Access app (quite big) at www.orbisoft.com/download. We have had requests by potential users to have it converted to an SQL version for them since there corporate policy excludes them from buying mdb backends. Here's the (million dollar?) questions :) How long and how difficult a process would it be? Which SQL platform would we be best to develop it on?
3
2880
by: Jon S via DotNetMonster.com | last post by:
Hi all, Is there a way to convert an Access.mdb from one format (say Access '97 or Access 2000) to Access 2002 format using ADO.NET and C#??? I know how to do it manually using the Access DBMS but I would like to know how to do it programatically. I don't have any idea if this can be done so if it can please could someone show the code to do it or provide links so I can read up on how to do it.
3
2076
by: genojoe | last post by:
I have tried everything I can think of to move records from one Access database to another. It should not be that hard. Read on.... I have identical access mdb's. One contains data; one contains empty tables. From an earlier posting, I was able to move the data by first exporting XML files and then importing them. I would like to find a way to skip the Import/Export steps. I first read the tables into a DataSet from the full...
0
3826
by: Juande | last post by:
Hello all, How can I export a table from Interbase to Access .mdb via ODBC in .NET?, Is there any working sample?, I've get to connect to Interbase and retrieve data from it in my VB .NET project, but I don't know how export this data to an Access table. Many thanks
1
3500
by: syvman | last post by:
Hi all... I've been trying to copy a VFP table into an Access database and I haven't had much success... The code I'm using below (Access VBA) returns a "Syntax Error" in the SQL statement. If I reduce the SQL statement from an "INSERT INTO" to just a plain "SELECT * FROM eg", it doesn't bomb out, but it also doesn't produce anything (are action queries not allowed in this situation?). The DSN I'm using (vfp151) is configured as an ODBC...
1
1528
by: D Kanagh | last post by:
Hello Does anyone know where I can obtain a function to test whetber my front-end is open via the provided icon vs. the Access 2000/2002 file menu? I want to test the open.mdb and if opened via the Access file menu prevent opening the mdb. I know I saw something way back on such a function or test on startup in this group..
3
2507
by: jc | last post by:
Hello. I want to ask about the possibility of copying both a table structure and it's contents from a SQL server table to a table within MS access. The problem cannot be solve with a permanent table structure at the target location. The names of the columns are essentially data with the application and so are subject to change. I am targeting a solution using SQL Query Manager. The approach I have tried (with failure) is SELECT *
0
1792
by: microb0x | last post by:
Is there any difference in the way an Access .mdb file is launched from directly double-clicking the file through windows explorer versus using code within another Access file to launch the same file? Here is my situation: I have an application that when launched does a check whether or not
2
4829
by: Martin | last post by:
From a PHP script, is there any way to retrieve data from an MS Access database that's located on another computer (on a LAN) other than by using ODBC? I posted a question here a couple of weeks ago about the problems I was having trying to do this via ODBC. I stated then that I was giving up trying to get it to work but I didn't. I foolishly have spent quite a few more hours in a futile attempt to get this to work. Now I'm to a point...
0
10226
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
10031
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11654
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...
0
11265
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10746
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
8324
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...
1
5013
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
2
4602
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3606
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.