Full Version: Count number of Tables
UtterAccess Discussion Forums > Microsoft® Access > Access Tables + Relationships
TheCaptain
Hello UA Members,

Not sure if i'm in the right thread here but here it goes. How can i count the number of Tables in TableDefs that the table name starts with "tbl_"? I have a command button on my form and want to put this code in the OnClick event. Any suggestions? Thanks in advance.

TheCaptain
datAdrenaline
Try out this expression ... it should get you what you need ...

DCount("*","MSysObjects","Left([Name],3) = 'tbl' And [Type] In (1,4,6)")

....

MSysObjects is a system table that Access maintains ... the tabledefs are entered in MsysObjects and can be of 3 different types ... 1= Local table, 4 = ODBC Linked table, 6 = Access linked table (I *think*)
TheCaptain
Brent,

Works great. Thanks. I was using the Dcount but had some wrong syntax. Can you tell me what the following is for in the expression?

and [Type] In (1,4,6)*

Thanks again

TheCaptain
TheCaptain
Never mind i just read the bottom of your previous post. Thanks and forgive my stupidity.
datAdrenaline
>> Thanks and forgive my stupidity. <<

laugh.gif ... Your welcome!! ... thumbup.gif

...

By the way ... I did edit my post immediately after I posted the expression ... so you may have missed the explaination ... sad.gif ....
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.