我正在尝试编写一个简单的函数来调整 Windows 7 下 MS Access 64 位版本中的文本字段的大小。它失败并出现错误 3420、对象无效或不再设置。为什么是这样?您不能在 MS Access 64 位版本下再更改代码中的表吗?
这是代码:
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