PC Review


Reply
Thread Tools Rate Thread

CreateField("ID", dbAutoIncrField) results in another data type

 
 
Bo Hansson
Guest
Posts: n/a
 
      30th Aug 2003
When creating Access tables from my Word VBA application I try the
following:

tdf.Fields.Append .CreateField("ID", dbAutoIncrField)

to get an auto incrementing field. The table is nicely created, but the data
type of
the auto field becomes an Integer. What's wrong ?

/BosseH


 
Reply With Quote
 
 
 
 
Douglas J. Steele
Guest
Posts: n/a
 
      30th Aug 2003
You need to add a Long Integer, then change its attribute to
dbAutoIncrField:

Dim fld1 As DAO.Field

Set fld1 = tdf.CreateField("ID", dbLong)
fld1.Attributes = fld1.Attributes + dbAutoIncrField
tdf.Fields.Append fld1


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele


"Bo Hansson" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> When creating Access tables from my Word VBA application I try the
> following:
>
> tdf.Fields.Append .CreateField("ID", dbAutoIncrField)
>
> to get an auto incrementing field. The table is nicely created, but the

data
> type of
> the auto field becomes an Integer. What's wrong ?
>
> /BosseH
>
>



 
Reply With Quote
 
Bo Hansson
Guest
Posts: n/a
 
      30th Aug 2003
Doug, thanks a lot !

/BosseH
"Douglas J. Steele" <(E-Mail Removed)> skrev i meddelandet
news:(E-Mail Removed)...
> You need to add a Long Integer, then change its attribute to
> dbAutoIncrField:
>
> Dim fld1 As DAO.Field
>
> Set fld1 = tdf.CreateField("ID", dbLong)
> fld1.Attributes = fld1.Attributes + dbAutoIncrField
> tdf.Fields.Append fld1
>
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
>
>
> "Bo Hansson" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > When creating Access tables from my Word VBA application I try the
> > following:
> >
> > tdf.Fields.Append .CreateField("ID", dbAutoIncrField)
> >
> > to get an auto incrementing field. The table is nicely created, but the

> data
> > type of
> > the auto field becomes an Integer. What's wrong ?
> >
> > /BosseH
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
"PUNJAB UNIVERSITY RESULTS" "KARACHI UNIVERSITY RESULTS" "PESHAWARUNIVERSITY LAHORE" "HAZARA UNIVERSITY RESULTS" "PUNJAB UNIVERSITY" "RESULTS" saima81 Microsoft C# .NET 0 14th Dec 2009 07:10 PM
Query criteria not returning results - "Data type mismatch..." =?Utf-8?B?S2F0ZUNlZQ==?= Microsoft Access Forms 18 18th Aug 2006 07:19 PM
Can I use REGEDIT to change a data type from "REG_SZ" to "REG_EXPAND_SZ" ? Stan Shankman Microsoft Windows 2000 Registry 3 16th Oct 2003 09:14 PM
Can I use REGEDIT to change a data type from "REG_SZ" to "REG_EXPAND_SZ" ? Stan Shankman Microsoft Windows 2000 Registry Archive 6 16th Oct 2003 09:14 PM
Can I use REGEDIT to change a data type from "REG_SZ" to "REG_EXPAND_SZ" ? Stan Shankman Microsoft Windows 2000 Registry Archive 0 16th Oct 2003 08:01 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:43 AM.