设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

返回列表 发新帖
查看: 1718|回复: 8
打印 上一主题 下一主题

[其它] 请高手按例讲解ACCESS字段值是如何导出到文本文件中去的?

[复制链接]
跳转到指定楼层
1#
发表于 2006-6-15 05:21:00 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
经过一段时间的学习,掌握了ACCESS表导出到文本文件中一些知识,但附件中    是如何将ACCESS表的字段值分别导出到文本文件中一直不得其解。请高手能否以附件为例详细讲解一下其操作办法及相关程序代码的含义。ACCESS表的字段值分别导出到文本文件中在具体工作中非常有用。急!

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享 分享淘帖 订阅订阅
2#
发表于 2006-6-15 07:02:00 | 只看该作者
现在网吧,不知你附件是什么内容,把问题描述具体一点
3#
 楼主| 发表于 2006-6-15 16:25:00 | 只看该作者
现附上
点击隐患数据输入窗口\生成WORD ,见"安全隐患整改通知书",请教"安全隐患整改通知书"文本中的ACCESS字段值是如何来的?                   

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
4#
发表于 2006-6-15 19:27:00 | 只看该作者
不是有源码吗?

Set Doc = CreateObject("word.application")
Doc.Visible = True
'打开Word文件
Doc.Documents.Open FileName:=CurrentProject.path & "\安全隐患通知书.dot"
'在Word文件中写入记录
Doc.Documents("安全隐患通知书.dot").FormFields(1).result = Me.ID
Doc.Documents("安全隐患通知书.dot").FormFields(2).result = Me.客户法定名称
Doc.Documents("安全隐患通知书.dot").FormFields(3).result = Me.同志
Doc.Documents("安全隐患通知书.dot").FormFields(4).result = Me.客户属性
Doc.Documents("安全隐患通知书.dot").FormFields(5).result = Me.客户属性
Doc.Documents("安全隐患通知书.dot").FormFields(6).result = Me.违章物地点
Doc.Documents("安全隐患通知书.dot").FormFields(7).result = Me.类型ID.Column(1)
Doc.Documents("安全隐患通知书.dot").FormFields(8).result = Me.规格ID.Column(1)
Doc.Documents("安全隐患通知书.dot").FormFields(9).result = Me.品种ID.Column(1)
Doc.Documents("安全隐患通知书.dot").FormFields(10).result = Me.设备型号
Doc.Documents("安全隐患通知书.dot").FormFields(11).result = Me.接触方式
Doc.Documents("安全隐患通知书.dot").FormFields(12).result = Me.安全距离
Doc.Documents("安全隐患通知书.dot").FormFields(13).result = Me.品种ID.Column(1)
Doc.Documents("安全隐患通知书.dot").FormFields(14).result = Me.水平距离
Doc.Documents("安全隐患通知书.dot").FormFields(15).result = Me.垂直距离
Doc.Documents("安全隐患通知书.dot").FormFields(16).result = Me.发送日期
Doc.Documents("安全隐患通知书.dot").FormFields(17).result = Me.ID
Doc.Documents("安全隐患通知书.dot").FormFields(18).result = Me.客户法定名称
Doc.Documents("安全隐患通知书.dot").FormFields(19).result = Me.同志
Doc.Documents("安全隐患通知书.dot").FormFields(20).result = Me.客户属性
Doc.Documents("安全隐患通知书.dot").FormFields(21).result = Me.客户属性
Doc.Documents("安全隐患通知书.dot").FormFields(22).result = Me.违章物地点
Doc.Documents("安全隐患通知书.dot").FormFields(23).result = Me.类型ID.Column(1)
Doc.Documents("安全隐患通知书.dot").FormFields(24).result = Me.规格ID.Column(1)
Doc.Documents("安全隐患通知书.dot").FormFields(25).result = Me.品种ID.Column(1)
Doc.Documents("安全隐患通知书.dot").FormFields(26).result = Me.设备型号
Doc.Documents("安全隐患通知书.dot").FormFields(27).result = Me.接触方式
Doc.Documents("安全隐患通知书.dot").FormFields(28).result = Me.安全距离
Doc.Documents("安全隐患通知书.dot").FormFields(29).result = Me.品种ID.Column(1)
Doc.Documents("安全隐患通知书.dot").FormFields(30).result = Me.水平距离
Doc.Documents("安全隐患通知书.dot").FormFields(31).result = Me.垂直距离
Doc.Documents("安全隐患通知书.dot").FormFields(32).result = Me.发送日期


'释放对象变量
Set Doc = Nothing
End Sub
5#
 楼主| 发表于 2006-6-16 15:31:00 | 只看该作者
请告知

1.在WORD模板中是如何设定是域,其操作详情

2.Doc.Documents("安全隐患通知书.dot").FormFields(2).result = Me.客户法定名称

   代码中FormFields(2).result 是何意思,其中(2).是否是WORD模板中的域位置?在模板中是如何定义的?
6#
 楼主| 发表于 2006-6-16 20:44:00 | 只看该作者
怎么没人指点?急
7#
发表于 2006-6-16 21:10:00 | 只看该作者

回复:(付谦)怎么没人指点?急

在Word上边框右键调出窗体工具栏后插入窗体文本框,见图:




本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
8#
 楼主| 发表于 2006-6-17 06:39:00 | 只看该作者
能否分步骤告诉详细的操作方法?谢谢!
9#
发表于 2006-6-17 10:39:00 | 只看该作者
编写好一篇word文档,将其中要变动的地方定义为“文字型窗体域”,另存为模版文档,用vba填充这些窗体域

这样写也行:FormFields("Text1").Result = "ABCDBEFG"
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-9-21 22:03 , Processed in 0.089373 second(s), 34 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表