Setting Default Value property via Code

G

Gibson

I am using the following code to create a table in the backend. How would I
set the Default value for the new field created (Field1)?

Set Db = OpenDatabase("C:\Backend.mdb")
Set tdfNew = Db.CreateTableDef("flkpNumber")
With tdfNew
.Fields.Append .CreateField("Field1", dbLong, 30)
Db.TableDefs.Append tdfNew
End With
 
B

Brendan Reynolds

Set tdfNew = db.CreateTableDef("flkpNumber")
With tdfNew
.Fields.Append .CreateField("Field1", dbLong, 30)
db.TableDefs.Append tdfNew
.Fields("Field1").DefaultValue = 9
End With
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top