R
Ray Mead
I have a function that creates a new field FileName, can I update that new
field value with the TName? Below is the function code:
Function AddFileName(TName As Variant, fldFileName As String) As Integer
Dim dB As Database, TDef As TableDef, fld As Field
' Get the current database.
Set dB = CurrentDb()
' Open the tabledef to which the counter field will be added.
Set TDef = dB.TableDefs(TName)
' Create a new FileName field
Set fld = TDef.CreateField(fldFileName, dbText)
On Error Resume Next
' Append the new field to the tabledef.
TDef.Fields.Append fld
' Check to see if an error occurred.
If Err Then
AddFileName = False
Else
AddFileName = True
End If
dB.Close
End Function
field value with the TName? Below is the function code:
Function AddFileName(TName As Variant, fldFileName As String) As Integer
Dim dB As Database, TDef As TableDef, fld As Field
' Get the current database.
Set dB = CurrentDb()
' Open the tabledef to which the counter field will be added.
Set TDef = dB.TableDefs(TName)
' Create a new FileName field
Set fld = TDef.CreateField(fldFileName, dbText)
On Error Resume Next
' Append the new field to the tabledef.
TDef.Fields.Append fld
' Check to see if an error occurred.
If Err Then
AddFileName = False
Else
AddFileName = True
End If
dB.Close
End Function