Table creation using Access type library...

  • Thread starter Thread starter Colin Basterfield
  • Start date Start date
C

Colin Basterfield

Hi,

I have imported a type library into my chosen development language and am
trying to create an 'AutoNumber' field but can't seem to get it to work.

I can successfully do it for all other fields by using

db := __DBEngine36.OpenDatabase('c:\viaducapp\livedb\norman2000.mdb',
True, False, '');

and then

td := db.CreateTableDef ('AUTO_MAIL', 0, '', '');
td.Fields.Append (td.CreateField ('AUTO_MAIL_ID', dbLong, 0));

and so I thought I would do this to make it an AutoNumber

td := db.CreateTableDef ('MAIL_MSG', 0, '', '');
fld := td.CreateField ('AUTO_MSG_ID', dbLong, 0);
fld.Attributes := dbAutoIncrField;
td.Fields.Append (fld); { mmMsgId }

but it didn't work.

Any ideas anyone?

TIA
Colin B
p.s. I'm using Delphi, but didn't put that until now in case anyone poured
scron on it! :-)))
 
I realise this is not really the place to ask this, so if someone could
point me to a more relevant newsgroup I would be grateful...

Thanks again
Colin B
 
Back
Top