简体   繁体   English

在MS Access中打开普及表时出现“无法多次定义字段”错误

[英]“Cannot define field more than once” error when opening Pervasive table in MS Access

A few months ago, I updated a system that uses Pervasive v11. 几个月前,我更新了使用Pervasive v11的系统。 Only after that update, I started having problems with MS Access (2003 and 2016 tested) failing to link or import certain Pervasive tables via ODBC with the error, "Cannot define field more than once." 仅在该更新之后,我才开始遇到MS Access问题(经过测试的2003和2016),无法通过ODBC链接或导入某些Pervasive表,并出现错误“无法多次定义字段”。 There are no fields with duplicate names in any of the failing tables. 任何失败表中都没有名称重复的字段。 I previously had no problems and now I suddenly do. 我以前没有问题,现在突然之间。 The only changes that I'm aware of is to table structures. 我知道的唯一变化是表结构。 I even created a new, very simple table and still get that error. 我什至创建了一个新的非常简单的表,仍然出现该错误。

I was informed by the system's retailer that this is no longer an issue as of Pervasive v13. 系统零售商告诉我,从Pervasive v13开始,这不再是问题。 How can I get around this problem without upgrading? 不升级怎么办?

I'm not sure exactly what the absolute answer is, beyond upgrading, but I did find a workaround that may be acceptable (it is for me). 除了升级,我不确定确切的答案是什么,但是我确实找到了可以接受的变通办法(对我来说)。 Despite not being a problem before, the root issue appears to be with the table (and perhaps field) names. 尽管以前没有问题,但根本的问题似乎是表(可能是字段)的名称。 MS Access is not happy with underscores some of the time . MS Access是不愉快的下划线一些时间 Honestly, I just opened another table with two underscores in the name and it succeeded, but MS Access still fails to open my custom table with two underscores. 老实说,我刚刚打开了另一个带有两个下划线的名称的表,但是成功了,但是MS Access仍然无法打开带有两个下划线的自定义表。

My workaround is to create new tables (or views for old tables) that have nothing other than straight alpha characters in the table name. 我的解决方法是创建新表(或旧表的视图),而表名中只包含纯字母字符。 If the view is simple enough (eg: select * from tablename ), then it is able to allow write access, which also allows MS Access to write data to that table via the view. 如果视图足够简单(例如: select * from tablename ),则它可以允许写访问,这也允许MS Access通过视图将数据写到该表。

I'm speculating that this problem may extend to field names with underscores in some circumstances. 我推测在某些情况下此问题可能会扩展到带下划线的字段名称。 Testing in PCC shows that giving an alias to a field does allow write access to the table. 在PCC中进行的测试表明,为字段提供别名确实允许对表进行写访问。 I mention this because I've seen some views cause a table to have read-only access when referenced via that view. 我之所以这样说,是因为我看到一些视图导致通过该视图引用时表具有只读访问权限。 I believe this happens when the view changes data-types or basic structure of a field. 我认为,当视图更改字段的数据类型或基本结构时,会发生这种情况。 For example, the system has a table with dates stored as 6 characters ( 060118 ), but the view shows that as SQL_Date ( 20180601 ). 例如,系统有一个表,其日期存储为6个字符( 060118 ),但视图将其显示为SQL_Date( 20180601 )。 That view does not allow adding or updating rows. 该视图不允许添加或更新行。

I'm sure some of what I just said is simple stuff that can be done with modern database systems and don't necessarily need explaining, but Pervasive has given me plenty of problems where other database systems would not, so I'm spelling out what I find that does work. 我敢肯定,我刚才所说的是可以用现代数据库系统完成的简单工作,并不一定需要解释,但是Pervasive给我带来了很多其他数据库系统无法解决的问题,所以我在阐述我发现确实有效。

I just saw your question when I was having the same warning trying to convert a table to a database (.dbf) from Access. 当我收到相同的警告试图从Access将表转换为数据库(.dbf)时,只看到了您的问题。 Simple tables I created myself had no problem, but data I had downloaded from data.gov (which I had cleaned and deleted fields) had trouble. 我创建的简单表没有问题,但是我从data.gov下载的数据(我已清理并删除了字段)却遇到了麻烦。 I experimented by removing the underscores, as the answer above suggests and also removed dashes (- it doesn't like them). 我通过删除下划线进行了实验,如上面的答案所示,并且还删除了破折号(-它不喜欢它们)。 Then I changed the data type in the ID (primary key) field. 然后,我更改了ID(主键)字段中的数据类型。 It was automatically formatted as a number (which it was - a 10 digit integer). 它会自动格式化为数字 (它是-10位整数)。 In design view, I changed the data type for the id (primary key) to 'text' and that fixed the problem. 在设计视图中,我将id(主键)数据类型更改为“文本” ,从而解决了该问题。 I had no trouble converting after that. 之后,我毫不费力地转换。 I'm not sure why. 我不知道为什么。 Also, I had to shorten some of the longer field names. 另外,我不得不缩短一些较长的字段名称。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 MS Access ODBC 连接错误 - “不能多次定义字段” - MS Access ODBC Connection error - "cannot define field more than once" ODBC 到 MS Access 的连接导入表失败,显示“无法多次定义字段” - ODBC Connection Import Tables to MS Access fails with "Cannot define field more than once" MS ACCESS:添加 concatrelated 后“字段可以引用多个表” - MS ACCESS: "field Could refer to more than one table listed" after adding concatrelated MS ACCESS指定的字段[XXXXX}可以引用FROM中列出的多个表 - MS ACCESS The specified field [XXXXX} could refer to more than one table listed in the FROM 当有多个时,MS Access SQL按最大值从分组字段中删除 - MS Access SQL Deleting from grouped field by max value when there is more than one 在MS Access Currency字段中存储四个以上的小数位 - Store more than four decimal places in an MS Access Currency field MS Access 2010 - 在多个字段上找到不匹配的向导 - MS Access 2010 - find unmatched wizard on more than one field 当查找表有多个匹配项时,MS Access 通过连接 2 个表中的字段进行更新 - MS Access update by joining fields from 2 tables when lookup table has more than one match ms access左连接输出的记录多于左表 - ms access left join outputting more records than in left table MS Access打开“在线会议”“未知网络错误”。 - MS Access “Online Meeting” “Unknown Network error.” When Opening
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM