MS Access:在DDL中设置表格列标题还是说明? [英] MS Access: setting table column Caption or Description in DDL?

查看:80
本文介绍了MS Access:在DDL中设置表格列标题还是说明?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用DDL在MS Access中设置表列的标题"或描述"属性?理想情况下,我们可以将它们包含在CREATE TABLE语句中.

Is it possible to set a table column's Caption or Description properties in MS Access using DDL? Ideally, we could include them in a CREATE TABLE statement.

推荐答案

使用DAO按照Andrea的建议设置Caption和Description属性.请注意,Caption和Description都是用户定义的,而不是默认属性,这意味着在为它们分配值之前它们并不存在.

Use DAO to set Caption and Description properties as Andrea suggested. Just be aware that both Caption and Description are user-defined, not default properties ... meaning that they don't exist before you assign them a value.

例如,以下语句触发错误3270,找不到属性",因为我尚未为id字段分配说明:

For example the following statement triggers error 3270, 'Property not found', because I have not assigned a Description for the id field:

Debug.Print CurrentDb.TableDefs("tblFoo").Fields("id").Properties("Description")

为了给该字段分配一个Description值,我首先必须为"Description"创建CreateProperty,然后将新属性附加到该字段的Properties集合中.建议您不要使用艾伦·布朗的Allen Browne的 SetPropertyDAO 函数.该功能将为您处理详细信息.确保也抓住了HasProperty函数,因为它是由SetPropertyDAO调用的. (HasProperty的代码在同一网页上,就在SetPropertyDAO函数代码的正下方.)

In order to assign a Description value for the field, I would first have to CreateProperty for "Description" then Append the new property to the field's Properties collection. Rather than write code to show you, I will suggest you use Allen Browne's SetPropertyDAO function. That function will handle the details for you. Be sure to grab the HasProperty function, too, because it is called by SetPropertyDAO. (The code for HasProperty is on the same web page, immediately below the SetPropertyDAO function code.)

这篇关于MS Access:在DDL中设置表格列标题还是说明?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆