R
rbm
I am trying to change all the text fields in my tables with a certain name to
a size of 33 characters using a module. It worked for setting
AllowZeroLength, but a similar code to change the field size returns an error
3219 "Invalid Operation".
The code runs through the tables and fields ok, but hangs up on the line
that sets the field size to 33. Any help would be appreciated.
The code I am using is this:
Public Function ChangeTxtFldSize()
On Error Resume Next
Dim i As Integer, J As Integer
Dim db As Database, td As TableDef, fld As Field
Set db = CurrentDb()
For i = 0 To db.TableDefs.Count - 1
Set td = db(i)
For J = 0 To td.Fields.Count - 1
Set fld = td(J)
If fld.Type = DB_TEXT And fld.Name Like ("*School*") Then
fld.Size = 33
End If
Next J
Next i
db.Close
Set db = Nothing
End Function
a size of 33 characters using a module. It worked for setting
AllowZeroLength, but a similar code to change the field size returns an error
3219 "Invalid Operation".
The code runs through the tables and fields ok, but hangs up on the line
that sets the field size to 33. Any help would be appreciated.
The code I am using is this:
Public Function ChangeTxtFldSize()
On Error Resume Next
Dim i As Integer, J As Integer
Dim db As Database, td As TableDef, fld As Field
Set db = CurrentDb()
For i = 0 To db.TableDefs.Count - 1
Set td = db(i)
For J = 0 To td.Fields.Count - 1
Set fld = td(J)
If fld.Type = DB_TEXT And fld.Name Like ("*School*") Then
fld.Size = 33
End If
Next J
Next i
db.Close
Set db = Nothing
End Function