dbTalk Databases Forums  

error #3259? A97

comp.databases.ms-access comp.databases.ms-access


Discuss error #3259? A97 in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
MLH
 
Posts: n/a

Default error #3259? A97 - 09-01-2006 , 08:18 AM






I get this error...
Invalid field data type
(3259)

When I run a line like this...
Set fld = tdf.CreateField("MyID", dbAutoIncrField)

dbAutoIncrField has an intrinsic value equal to 16.
Any reason why this should not work in Access 97?

Reply With Quote
  #2  
Old   
Allen Browne
 
Posts: n/a

Default Re: error #3259? A97 - 09-01-2006 , 08:44 AM






If you open the object viewer (press F2 in the code window), and search on
dbAutoIncrField, you will discover it is a member of:
FieldAttributeEnum
not a member of:
DataTypeEnum

An Autonumber is a field of type Long Integer (dbLong), that has its
Attributes set to dbAutoIncrField plus whatever other attributes apply. A
Long is a fixed width field, so dbFixedField is the other attribute you
need.

So, you need something like this:
Set fld = tdf.CreateField("MyID", dbLong)
fld.Attributes = dbAutoIncrField + dbFixedField
tdf.Fields.Append fld

You might find this a useful reference:
Field type reference - names and values for DDL, DAO, and ADOX
at:
http://allenbrowne.com/ser-49.html
It compares the names in the interface with the names you use in DDL query
statements, DAO code, and ADOX code.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"MLH" <CRCI (AT) NorthState (DOT) net> wrote

Quote:
I get this error...
Invalid field data type
(3259)

When I run a line like this...
Set fld = tdf.CreateField("MyID", dbAutoIncrField)

dbAutoIncrField has an intrinsic value equal to 16.
Any reason why this should not work in Access 97?




Reply With Quote
  #3  
Old   
MLH
 
Posts: n/a

Default Re: error #3259? A97 - 09-01-2006 , 09:53 AM



That was very helpful.
Thanks, Allen

Reply With Quote
  #4  
Old   
MLH
 
Posts: n/a

Default Re: error #3259? A97 - 09-01-2006 , 10:08 AM



Along that same line, I looked into
A97 HELP a bit and found these
Types all listed together in a section
that seems to imply they can be valid
values in the code line...

dbBigInt Big Integer
dbBinary Binary
dbBoolean Boolean
dbByte Byte
dbChar Char
dbCurrency Currency
dbDate Date/Time
dbDecimal Decimal
dbDouble Double
dbFloat Float
dbGUID GUID
dbInteger Integer
dbLong Long
dbLongBinary Long Binary (OLE Object)
dbMemo Memo
dbNumeric Numeric
dbSingle Single
dbText Text
dbTime Time
dbTimeStamp Time Stamp
dbVarBinary VarBinary

Most of my own needs can be satisfied with
dbBoolean, dbDate, dbInteger, dbLong and
dbText. Do you think most of the above mentioned
types will work without a hitch?

Reply With Quote
  #5  
Old   
Allen Browne
 
Posts: n/a

Default Re: error #3259? A97 - 09-01-2006 , 09:36 PM



Most of those work with Access tables, but some work only with attached
tables from SQL Server or other databases.

Some of the names you see in the interface (like AutoNumber, and Hyperlink)
are not obvious from that list.

Some (like binary and fixed-width text) can be created with Access tables,
but not through the interface.

And there are other types in Access 2007 (such as dbAttachment and
dbComplexText.)

Ther reference list I personally use is:
http://allenbrowne.com/ser-49.html
and the footnotes tell you most of the extra aspects of the story.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"MLH" <CRCI (AT) NorthState (DOT) net> wrote

Quote:
Along that same line, I looked into
A97 HELP a bit and found these
Types all listed together in a section
that seems to imply they can be valid
values in the code line...

dbBigInt Big Integer
dbBinary Binary
dbBoolean Boolean
dbByte Byte
dbChar Char
dbCurrency Currency
dbDate Date/Time
dbDecimal Decimal
dbDouble Double
dbFloat Float
dbGUID GUID
dbInteger Integer
dbLong Long
dbLongBinary Long Binary (OLE Object)
dbMemo Memo
dbNumeric Numeric
dbSingle Single
dbText Text
dbTime Time
dbTimeStamp Time Stamp
dbVarBinary VarBinary

Most of my own needs can be satisfied with
dbBoolean, dbDate, dbInteger, dbLong and
dbText. Do you think most of the above mentioned
types will work without a hitch?



Reply With Quote
Reply




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.