2
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by vb5prgrmr
0

That all depends upon if you allow those fields to default to their default values or not. As for changing those default values lets see your table creation code...

0

Set login = OpenDatabase("database path")
Set newtable = login.CreateTableDef("table_name")
With newtable
.Fields.Append .CreateField("name", dbText, 30)
end with
now wat is the default initial value and how can i change it?

0

Okay, this example works with both 2.5/3.51 and 3.6...

Dim daoDb As DAO.Database
Dim daoTd As DAO.TableDef

Set daoDb = DBEngine.CreateDatabase("C:\z\MyDB.mdb", dbLangGeneral, dbVersion30)

Set daoTd = daoDb.CreateTableDef("MyTable")

daoTd.Fields.Append daoTd.CreateField("iID", dbLong)
daoTd.Fields("iID").Attributes = dbAutoIncrField

daoTd.Fields.Append daoTd.CreateField("vFName", dbText, 30)
daoTd.Fields("vFName").AllowZeroLength = True
daoTd.Fields("vFName").DefaultValue = "Enter First Name Here"

daoDb.TableDefs.Append daoTd

Set daoTd = Nothing
daoDb.Close
Set daoTd = Nothing

Good Luck

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.