On the control of my form i want to give a command for creating fields
in a table.However i receive the message error variable not defined.
May i have some help as to where is my error?
Dim dbs As Database
Dim tdf As DAO.TableDef
Dim fld As DAO.Field
Dim prp As DAO.Property
Dim idx As DAO.Index
Set tdf = dbs.TableDefs("Orders")
Set fld = tdf.CreateField("LastUpdated", dbDate)
tdf.Fields.Append fld
tdf.Fields.Refresh
' set additional field properties
Set fld = tdf.Fields("LastUpdated")
fld.Properties("DefaultValue") = "=Date()"
Set prp = fld.CreateProperty("Format", dbText, "Short Date")
fld.Properties.Append prp
' create and append index
Set idx = tdf.CreateIndex("LastUpdatedIdx")
idx.Fields.Append idx.CreateField("LastUpdated")
idx.Unique = False
tdf.Indexes.Append idx
dbs.Close
Set prp = Nothing
Set idx = Nothing
Set fld = Nothing
Set tdf = Nothing
Set dbs = Nothing
End Function
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!