Access2013将LongText从一个LongText字段复制到另一个LongText字段 [英] Access2013 Copy LongText from one LongText field to another

查看:159
本文介绍了Access2013将LongText从一个LongText字段复制到另一个LongText字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

拥有一个包含2个基本表的Access2013数据库。  我需要将Table1中三个longtext字段中的577个字符复制到Table2中的单个longtext字段。  我需要这样做,因为Table2是一个可重复使用的表,每个月都会被清除
而Table1是主要的数据来源。  数据最初输入到表单上的4个纯文本字段中,并以纯文本形式存储在Table1的三个longtext字段中。  我尝试了一个Append查询,无论我如何将三个字段放在一起
(使用'&','+',concatenate())数据截断为255 chrs。  我看到在longtext字段中获得超过255个chrs的唯一方法是直接打开表并手动输入。

Have an Access2013 database with 2 basic tables.  I need to copy the 577 characters from three longtext fields located in Table1 to a single longtext field in Table2.  I need to do this because Table2 is a reusable table and gets cleared each month whereas Table1 is the main source of data.  The data is initially entered into 4 plain-text fields on a form and stored as plain text in the three longtext fields of Table1.  I've tried an Append query and no matter how I put the three fields together (using '&', '+', concatenate()) the data ends truncated at 255 chrs.  The only way I've seen to get more than 255 chrs into a longtext field is to open the table directly and type them in manually.

我真的需要一个vba代码解决方案获取三个Table1 longtext字段并将它们连接为单个字符串(始终小于65K chrs)并将组合数据作为连续字符串放入Table2中的单个longtext字段而不截断。
 我在网上搜索过,但没有找到有效的解决方案。  有人建议使用"ADODB.command"哪个不编译。  其他一些混乱的QueryDef也没有用。

I really need a vba code solution that takes the three Table1 longtext fields and concatenates them as a single string (always less than 65K chrs) and places the combined data into the single longtext field in Table2 as a continuous string without truncating.  I've searched the web and haven't found a solution that's worked.  Some suggested "ADODB.command" which doesn't compile.  Others mess with QueryDef which also hasn't worked.

任何人都可以获得实际工作而无需添加引用,安装插件或是一个巨大的线索吗?  非常感谢。

Anyone got something that actually works without having to add References, install addins or is a huge cluge?  Thanks very much.

推荐答案

执行追加查询以从一个文本中取出长文本(或短文本)字段时我没有遇到任何问题table,连接它们,并将它们放在另一个表中新记录的长文本字段中。 在VBA中,沿着这些方向的东西应该起作用(留下
的任何标准来限制附加的记录):

I have no trouble executing an append query to take long text (or short text) fields from one table, concatenate them, and place them in a long text field in a new record in another table.  In VBA, something along these lines ought to work (leaving out any criteria to limit the records appended):

CurrentDb.Execute "INSERT INTO Table2 ([Field1], [Field2], [Field3], [Field4]) SELECT [Field1], [Field2], [Field3], ([Field1] & [Field2] & [Field3]) FROM Table1", dbFailOnError




假设Table2具有所有三个原始字段,但添加第四个是前三个字段的串联。 如果 - 适合你的桌子和田野名称 - 不起作用,那么你的情况就是你没有告诉我们的



That assumes that Table2 has all three of the original fields, but adds a fourth that is the concatenation of the first three.  If that -- suitably adapted to your table and field names -- doesn't work, then there's something about your circumstances that you haven't told us.


这篇关于Access2013将LongText从一个LongText字段复制到另一个LongText字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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