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