Oleg_123 at xuppa.com
Oleg_123 at xuppa.com
Fri Feb 7 15:09:00 CST 2003
doesn't work -- I get a "type mismatch error" :-/ > For an AutoNumber field, try this syntax: > > Set fldNewField = tdfNewTable.CreateField("BatchID", dbLong) > ' make it an AutoNumber > fldNewField.Attributes = dbAutoIncrField > ' append BatchID field > tdfNewTable.Fields.Append fldNewField > > Its worked for me in the past. > > Rich > > -----Original Message----- > From: Oleg_123 at xuppa.com [mailto:Oleg_123 at xuppa.com] > Sent: Wednesday, February 05, 2003 1:20 PM > To: accessd at databaseadvisors.com > Subject: RE: [AccessD] adding field to table via code > > > Thank you, the first one works , the second one (wherei try to make a > field ino autonumber, doesn't) Private Sub Command29_Click() > > Dim dbDM As Database > Dim tbGAP As TableDef > Dim fldLoop As Field > > Set dbDM = CurrentDb > Set tbGAP = dbDM.CreateTableDef("Andy") > > With tbGAP > .Fields.Append .CreateField("PriKey", dbInteger) > End With > > dbDM.TableDefs.Append tbGAP > > End Sub > > Private Sub Command29_Click() > > Dim dbDM As Database > Dim tbGAP As TableDef > Dim fldLoop As Field > > Set dbDM = CurrentDb > Set tbGAP = dbDM.TableDefs("Andy") > > With tbGAP > .Fields.Append .CreateField("PriKey", dbAutonumber) > End With > > dbDM.TableDefs.Append tbGAP > > End Sub > > ---------------------------- > > > > > > ----------------------------------------- > Send a Xuppa Valentine to Your Sweetheart today! > http://www.xuppa.com/greet/ > > > _______________________________________________ > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > _______________________________________________ > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com ----------------------------------------- Send a Xuppa Valentine to Your Sweetheart today! http://www.xuppa.com/greet/