[AccessD] adding field to table via code

Oleg_123 at xuppa.com Oleg_123 at xuppa.com
Sat Feb 8 17:22:00 CST 2003


hi Andy,

I notoced, don't know why...I have 2000 version
I also meant to ask you, what is "Pancake Day"  ? :)

--------------

> Oleg
> Still don't know why you're getting this. Rich's answer's the same as
> mine and obviously works =for him too. Put it in debug and see what it
> is that's causing it. Oh, and as I asked before, which version are you
> using?
>
> Andy Lacey
> http://www.minstersystems.co.uk
>
>
>
>> -----Original Message-----
>> From: accessd-admin at databaseadvisors.com
>> [mailto:accessd-admin at databaseadvisors.com] On Behalf Of
>> Oleg_123 at xuppa.com
>> Sent: 07 February 2003 21:08
>> To: accessd at databaseadvisors.com
>> Subject: RE: [AccessD] adding field to table via code
>>
>>
>> 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/
>
>
> _______________________________________________
> 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/





More information about the AccessD mailing list