adding fields

rodf
08-31-2000, 07:48 PM
How can i make to allow the user to insert or delet datafields?I'm using the the most simple mode, with mdb files and data control. Thanks for helping!

Helmar
09-01-2000, 09:51 AM
Here's code that will add a field to an Access .MDB file using Jet/DAO:

' Assume that Db is an open database and that you're adding
' fields to the "System" table.......

Dim Td As TableDef
Dim F As Field
Set Td = Db.TableDefs("System")

' Add a Text field
Set F = Td.CreateField("NewTextField", dbText, 25)
F.AllowZeroLength = True
Td.Fields.Append F
' Add a Boolean field
Set F = Td.CreateField("NewBooleanField", dbBoolean, 0)
Td.Fields.Append F
Td.Close

Helmar B. Herman, VP ProtoProducts

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum