list table named from access database

User avatar
sal21
PlatinumLounger
Posts: 4486
Joined: 26 Apr 2010, 17:36

list table named from access database

Post by sal21 »

I need to list all tables name from access database...

but only for table where left 2 is numeric. (see image)

note:
i use ADO and Vb6
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 79419
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: list table named from access database

Post by HansV »

Is it OK to use DAO?
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4486
Joined: 26 Apr 2010, 17:36

Re: list table named from access database

Post by sal21 »

HansV wrote:
03 May 2022, 15:45
Is it OK to use DAO?
no prob!

User avatar
HansV
Administrator
Posts: 79419
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: list table named from access database

Post by HansV »

Actually, it doesn't matter.
Open a recordset with the following SQL.

If you use DAO:

Code: Select all

    SQL = "SELECT MSysObjects.Name FROM MSysObjects WHERE MSysObjects.Name Like '[0-9][0-9]*' AND MSysObjects.Type=1"
If you use ADODB:

Code: Select all

    SQL = "SELECT MSysObjects.Name FROM MSysObjects WHERE MSysObjects.Name Like '[0-9][0-9]%' AND MSysObjects.Type=1"
Best wishes,
Hans