3 replies
by colm_maguire
Hi Zool,
Don't know if you can use a macro but here's some VBA code straight from the Help files that you could modify to set the value if the datas type to Date/Time. You would need to have some way of collecting the name of the field to change (if you want the code to be flexible) such as a combo box on a form that uses a field listing for a table inits drop down menu.
Sub NewField()
Dim dbs As Database, tdf As TableDef
Dim fld As Field
' Return reference to current database.Set dbs = CurrentDb
' Return reference to Employees table.
Set tdf = dbs.TableDefs!Employees
' Create new Field object.
Set fld = tdf.CreateField("SSN#")
' Set Type and Size properties of Field object.
fld.Type = dbText
fld.Size = 11' Append field.
tdf.Fields.Append fld
' Enumerate all fields in Fields collection of TableDef object.
For Each fld in tdf.Fields
Debug.Print fld.Name
Next fld
Set dbs = Nothing
End Sub
Any reason why you don't just do it manually?
by zool326
by zool326
This discussion is closed to new replies.
Trending Software posts
Sort by Trending