M
Max
I have the following in a module in an Access 2K database:
Public Function ChangeFieldName()
Dim dbs As Database, tdfloop As TableDef, i As Integer, MyField As String
Set dbs = CurrentDb()
With dbs
For Each tdfloop In .TableDefs
With tdfloop
For i = 1 To .Fields.Count
MyField = .Fields(i - 1).Name
If MyField = "OptionOrderCaption" Then
.Fields(i - 1).Name = "OptionUpgradeNo"
.Fields(i - 1).Type = "Number"
End If
Next i
End With
Next tdfloop
End With
The line .Fields(i - 1).Type = "Number" is not working. What am I doing
wrong?
Need to set a text field to a number field.
Thanks in advance.
Public Function ChangeFieldName()
Dim dbs As Database, tdfloop As TableDef, i As Integer, MyField As String
Set dbs = CurrentDb()
With dbs
For Each tdfloop In .TableDefs
With tdfloop
For i = 1 To .Fields.Count
MyField = .Fields(i - 1).Name
If MyField = "OptionOrderCaption" Then
.Fields(i - 1).Name = "OptionUpgradeNo"
.Fields(i - 1).Type = "Number"
End If
Next i
End With
Next tdfloop
End With
The line .Fields(i - 1).Type = "Number" is not working. What am I doing
wrong?
Need to set a text field to a number field.
Thanks in advance.