连接到ODBC时的MS Access错误 [英] MS Access error when connected to ODBC
问题描述
当尝试在MS Access 2010中的Varchar不为null的字段中添加一行时,出现错误您试图将Null值分配给不是变量数据类型的变量"
When attempting to add a line in MS Access 2010 in a field which is Varchar not null i am getting the error "you tried to assign the Null value to a variable that is not a variant data type"
我正在使用来自sql数据库的ODBC连接,该连接允许表中为空值,但在尝试添加访问行时不允许这样做
I am using an ODBC connection from an sql database which allows the empty value in the table but not when trying to add rows in access
我认为这是我读到的2007年的常见错误?
I believe this to have been a common fault in 2007 from what i have read?
首先,有人知道是否可以通过简单的方法解决此问题吗?
Firstly does anyone know if there is a simple work around for this problem?
其次,我目前在使用Office 2010 Professional plus 14.0.7015.1000版本的Microsoft网站上找不到此补丁程序
Secondly I can't see a patch for this on the microsoft website i am currently using office 2010 professional plus version 14.0.7015.1000
推荐答案
在Access中,当在表中(直接在数据表视图"中或以绑定形式)输入直接"值时,只需将单元格/控件留空即可尝试插入NULL值.如果基础表中的相应列不允许NULL值,则插入将失败.
In Access, when entering a value "directly" into a table (either in Datasheet View or in a bound form), simply leaving the cell/control empty will attempt to insert a NULL value. If the corresponding column in the underlying table does not allow NULL values then the insert will fail.
解决方法是输入
""
进入单元格/控件以指定一个空字符串(与NULL值不同).我刚刚在Access 2010上针对SQL Server 2008 R2在ODBC链接表上对此进行了测试,并且可以正常工作.
into the cell/control to specify an empty string (which is not the same as a NULL value). I just tested this on an ODBC linked table against SQL Server 2008 R2 from Access 2010 and it worked.
这篇关于连接到ODBC时的MS Access错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!