问题描述
我想编写一个简单的功能,在Windows 7来调整在MS Access 64位版本的文本字段它失败,错误3420,对象无效或不再设置。为什么是这样?你不能改变的code表了在MS访问64位版本?
下面是code:
专用功能ResizeSingleTextField(sTableName作为字符串_
sFieldName作为字符串_
iLength作为整数)
ResizeSingleTextField = FALSE
昏暗sSQL作为字符串
sSQL =ALTER TABLE和放大器; sTableName和放大器; _
&放大器; ALTER COLUMN&放大器; sFieldName和放大器; _
&放大器; TEXT(&放大器; iLength&安培;)
CurrentDb.Execute(sSQL)
ResizeSingleTextField = TRUE
退出功能
端功能
公用Sub调用testIt()
昏暗的结果作为布尔
结果= ResizeSingleTextField(GregTest,myTextField的,12)
Debug.Print结果
结束小组
这是在该版本的Access一个已知的bug。请参阅Microsoft知识库中相应的第2516493 。
在这里摘录:
有一个修补程序随附在四月来解决这个问题。 Access 2010中运行Service Pack 1的出来2011年8月,和根据发行说明包括针对此问题的修复。
I am trying to write a simple function to resize a text field in MS Access 64 bit version under Windows 7. It fails with the error 3420, object invalid or no longer set. Why is this? Can't you alter a table in code anymore under MS Access 64bit version?
Here is the code:
Private Function ResizeSingleTextField(sTableName As String, _
sFieldName As String, _
iLength As Integer)
ResizeSingleTextField = False
Dim sSQL As String
sSQL = "ALTER TABLE " & sTableName & " " _
& "ALTER COLUMN " & sFieldName & " " _
& "TEXT (" & iLength & ")"
CurrentDb.Execute (sSQL)
ResizeSingleTextField = True
Exit Function
End Function
Public Sub TestIt()
Dim result As Boolean
result = ResizeSingleTextField("GregTest", "MyTextField", 12)
Debug.Print result
End Sub
It's a known bug in that version of Access. See MS Knowledge Base Article 2516493.
Excerpted here:
There is a hotfix that came out in April to remedy the issue. Access 2010 Runtime Service Pack 1 came out in August 2011, and according to the release notes includes a fix for this issue.
这篇关于alter table将不根据MS访问64位工作。为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!