VBA Schema Changes

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Just need some help please with the syntax to make a Schema change in Access
from VBA.

For instance (one that works) :-

Set tbd = dbs.TableDefs("tblAL")
tbd.Fields("AssM").AllowZeroLength = True

This sets property of field AssM to allow zero length.

I need something like :-

Set tbd = dbs.TableDefs("tblAL")
tbd.Fields("Booked").Format = ShortDate

basically, field Booked is a DATETIME field and I would like to set it to a
short date(dd/mm/yy - 97) or (dd/mm/yyyy - 2k onwards).

Can you help with syntax?

Thanks.
 
Hi Andy,

I think you are just missing the text delimiter

try

tbd.Fields("Booked").Format = "ShortDate"

when you dimension tdb, make sure to include the DAO library as part of
the reference

dim tbd as DAO.tabledef


Warm Regards,
Crystal
*
(: have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
 
Thanks for this - unfortunately, not as easy as we would have wished.

The thing is, there is no Format attribute to tbd.fields so it will not
compile. There are Properties or Type attributes but these also don't seem to
work.

Any further ideas?

Thanks.
------------
 
Hi Andy,

did you do this at the top of your program?

dim tbd as DAO.tabledef

also, do you have a reference to a Microsoft DAO library?

Warm Regards,
Crystal
*
(: have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
 
Back
Top