We ve just upgraded from Access 2003 to Access 2010 and string comparisons are failing with an invalid procedure call error when default conditions are used. I’ve recreated two presumably related problems in a new Access 2007 format database containing only the default table, a query with the SQL below and a module containing only the code below, so I seriously doubt that this is a corruption issue. First the following sub fails on the If Then line with Run-time error 5: Invalid procedure call or argument
Option Compare Database
Option Explicit
Sub checkStrCmp()
Dim str As String
str = "s"
If str = "s" Then
MsgBox "works"
End If
End Sub
如果我改变选项比较数据库与选项比较文本, 子系统会像预期的那样运作, 但这似乎是个坏主意, 我可能想要预设文本, 并在单个子系统内进行数字比较 。
在 SQL 内部的字符串比较函数中, 我也会收到“ 无效程序调用” 错误 。 替换函数需要所谓的可选比较参数 。
Select replace("foo-bar-baz", "-", "|", 1,-1);
生成“无效程序呼叫”错误
设置参数与任何可用值(0-3)的比较,以便按预期工作:
SELECT replace("foo-bar-baz", "-", "|", 1,-1, 0);
“foobarbaz”生产厂
Has anyone else seen this? Is there a setting that needs to be tweaked? Any other ideas outside of “Database corruption” which is all I’ve been able to find via Google. TIA
政策为草率的代码块 我无法为我的生命 让他们工作的权利。
问题似乎仅限于我在我的盒子上创建的数据库。 当我打开我从我们网络上的其他工作站上创建的测试数据库时,我看到了这个问题,但在创建上面描述的关于这些工作站的新数据库时却无法重新创建它。 我在其他两个工作站上创建的数据库(同样的OS和MS Office版本已安装)在打开我的机器时也是正确的。 当我从我的机器上插入了这些 DB 中的新模块时,我也无法重新创建这个问题。
简言之,问题似乎只存在于我机器上创建的数据库上(在旧的2003年格式数据库中,我在机器上转换为2007年格式 ) 。 我最好的猜测是,我的安装系统被冲洗了,但我想先了解一下如何和为什么我才使用信息技术,然后请求重新安装办公室。 我还想排除与我盒子上其他软件的冲突。