By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,395 Members | 1,382 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,395 IT Pros & Developers. It's quick & easy.

how to get the ID autonumber field to be added when importing

P: n/a
I am doing the
TransferText method to import a tab delimited file. I am using a saved
specification.
DoCmd.TransferText acImportDelim, "myinputspec", "tblnames", File, True

no autonumber ID is created, how can I fix this?
but when I do it from the access import from menu choice, it adds an ID.

how to do in code.

Thanks
Nov 12 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Danny wrote:
I am doing the
TransferText method to import a tab delimited file. I am using a saved
specification.
DoCmd.TransferText acImportDelim, "myinputspec", "tblnames", File, True

no autonumber ID is created, how can I fix this?
but when I do it from the access import from menu choice, it adds an ID.

how to do in code.


Make one of your table fields an autonumber.
Nov 12 '05 #2

P: n/a

"Salad" <oi*@vinegar.com> wrote in message
news:aV*****************@newsread1.news.pas.earthl ink.net...
Danny wrote:
I am doing the
TransferText method to import a tab delimited file. I am using a saved
specification.
DoCmd.TransferText acImportDelim, "myinputspec", "tblnames", File, True

no autonumber ID is created, how can I fix this?
but when I do it from the access import from menu choice, it adds an ID.

how to do in code.


Make one of your table fields an autonumber.


How to in code
the create field method doesnt let you specify autonumber
what to do?
for example:
td.Fields.Append td.CreateField(fieldname, dbText)

no autonumber option to replace dbText

Nov 12 '05 #3

P: n/a
On Fri, 21 May 2004 07:04:20 GMT, "Danny" <da********@hotmail.com> wrote:

"Salad" <oi*@vinegar.com> wrote in message
news:aV*****************@newsread1.news.pas.earth link.net...
Danny wrote:
> I am doing the
> TransferText method to import a tab delimited file. I am using a saved
> specification.
> DoCmd.TransferText acImportDelim, "myinputspec", "tblnames", File, True
>
> no autonumber ID is created, how can I fix this?
> but when I do it from the access import from menu choice, it adds an ID.
>
> how to do in code.
>


Make one of your table fields an autonumber.


How to in code
the create field method doesnt let you specify autonumber
what to do?
for example:
td.Fields.Append td.CreateField(fieldname, dbText)

no autonumber option to replace dbText


The AutoNumber is an attribute of the field, not a field type, (the field type is a dbLong).
Create a new field, set it's attributes and then append it to the TableDef -

Set fldNew = tdf.CreateField(fieldname, dbLong)
fldNew.Attributes = dbAutoIncrField
tdf.Fields.Append fldNew
Wayne Gillespie
Gosford NSW Australia
Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.