S
Scott N. Weber
I need to create a program that will modify the structure of a table.
Specfically, I need to change the default value of a field within the table.
I have this code shown below but it won't change the value.
fldOld.Properties.Append fldOld.CreateProperty(propNew.name, propNew.Type,
propNew.Value)
This code actually compares all of the properties between two tables and if
the feilds are different then it updates the old table with the property of
the new setting. But I do NOT have to do it that way. The only thing I need
right now is to set the default value for an existing feild via code. If
there is another approach please let me know. Below is more of the code for
your reference.
Set fldOld = tblOld(fldNew.name)
Dim propNew As Property
Dim valOld, valNew As Variant
For Each propNew In fldNew.Properties
'Debug.Print " " & propNew.name
On Error Resume Next
If Not ignoreProp(propNew.name) Then
valOld = "<Unavailable>"
valNew = "<Unavailable>"
valOld = fldOld.Properties(propNew.name).Value
valNew = propNew.Value
If Not (valOld = valNew) Then
fldOld.Properties.Append fldOld.CreateProperty(propNew.name,
propNew.Type, propNew.Value)
End If
On Error GoTo cmdUpdate_err
End If
Next propNew
Specfically, I need to change the default value of a field within the table.
I have this code shown below but it won't change the value.
fldOld.Properties.Append fldOld.CreateProperty(propNew.name, propNew.Type,
propNew.Value)
This code actually compares all of the properties between two tables and if
the feilds are different then it updates the old table with the property of
the new setting. But I do NOT have to do it that way. The only thing I need
right now is to set the default value for an existing feild via code. If
there is another approach please let me know. Below is more of the code for
your reference.
Set fldOld = tblOld(fldNew.name)
Dim propNew As Property
Dim valOld, valNew As Variant
For Each propNew In fldNew.Properties
'Debug.Print " " & propNew.name
On Error Resume Next
If Not ignoreProp(propNew.name) Then
valOld = "<Unavailable>"
valNew = "<Unavailable>"
valOld = fldOld.Properties(propNew.name).Value
valNew = propNew.Value
If Not (valOld = valNew) Then
fldOld.Properties.Append fldOld.CreateProperty(propNew.name,
propNew.Type, propNew.Value)
End If
On Error GoTo cmdUpdate_err
End If
Next propNew