Table Description using VBA

G

Gary Brown

Does anyone know how to change the Table Description using VBA?
I can do it manually by right-clicking on a table, selecting 'Properties'
and typing in a description but I'd like to do that via code.
Any help would be greatly appreciated.
 
W

Wayne-I-M

I think that you may be wanting to do more with the table then you should ??
Dn't use the table for much more than storeing basic data - OK you can set
some idexes, define field types, etc. But in essence you should not need to
alter anything about the properties view vba

Just use a table as an old fashion filing cabinet draw - it holds bits of
info, to do anything with the info your need to take it out - or in this case
you need a form or a query, report, module, etc
 
G

Gary Brown

Thanks for the quick reply, Wayne.
In my current project, I'm creating a table on the fly and want to add a
description for documentation purposes so others besides myself will know
what the table's about.
Sincerely,
Gary Brown
 
G

Gary Brown

db.TableDefs(TableName).Properties("Description") = Description

Exactly what I was looking for!
Have a great weekend.
Off to celebrate Independence Day!
 
W

Wayne-I-M

Just tested this and I can't get it work with VBA but it works fine with DAO.
But it took me 10 min to write some code in a public module to do what woud
have taken a few seconds in the properties box - whats the point.

Oh well up to you. Use DAO and you'll get it to work -
but still think it not worth it ;-)
 
Joined
Jan 20, 2013
Messages
1
Reaction score
0
I have tried this codes and it works fine

Dim tbName As String
Dim tbDesc As String

With db.TableDefs(tbName)
Set myP = .CreateProperty("Description", dbText, tbDesc)
.Properties.Append myP
End With
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top