We help IT Professionals succeed at work.

Access Schema

351 Views
Last Modified: 2017-03-20
Is there a way to retrieve a database schema using the AccessDataSource and Visual Basic?

I only want to retrieve the table names.

Thanks
Comment
Watch Question

Dale FyeOwner, Dev-Soln LLC
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2010

Commented:
you can use the mSysObjects table, which is a hidden system table.

SELECT [Name] as TableName , [Database], [Type] FROM mSysObjects
WHERE [Type] = 6
OR [Database] is not NULL

I think there is another type that is involved here besides 6, but don't remember what it is right off the top of my head.  6 will get you built-in tables, if you have linked tables, you might want to check what the type is associated with them, which is what the 2nd criteria above will do for you.
Owner, Dev-Soln LLC
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2010
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION
Jim Dettman (EE MVE)President / Owner
CERTIFIED EXPERT
Fellow
Most Valuable Expert 2017

Commented:
If you use ADO with the JET OLEDB provider, you can use the DBSCHEMA_TABLES rowset.  

There's also getoledbschematable:

https://support.microsoft.com/en-us/help/309488/how-to-retrieve-schema-information-by-using-getoledbschematable-and-visual-basic-.net

or you can set a reference (if you did mean VB and not  VB.Net)  to the DAO lib and use the tabledef's collection.

But if your already reading the DB, then you can use's Dale's back door method as well.

Jim.
John TsioumprisIT Supervisor
CERTIFIED EXPERT
Distinguished Expert 2019
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and Programming
CERTIFIED EXPERT
Top Expert 2015
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION
Ray TurnerSenior Consultant

Author

Commented:
Thanks

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions