error #3259? A97

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • MLH

    #1

    error #3259? A97

    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?
  • Allen Browne

    #2
    Re: error #3259? A97

    If you open the object viewer (press F2 in the code window), and search on
    dbAutoIncrField , you will discover it is a member of:
    FieldAttributeE num
    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.Appe nd fld

    You might find this a useful reference:
    Field type reference - names and values for DDL, DAO, and ADOX
    at:
    Reference for the field types in a Microsoft Access database, matching the names in the Access interface, the names in DDL queries, the DAO constants, and the ADOX constants.

    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@NorthStat e.netwrote in message
    news:pecgf2lh95 11pd0q2mapifho4 2285u8p1h@4ax.c om...
    >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?


    Comment

    • MLH

      #3
      Re: error #3259? A97

      That was very helpful.
      Thanks, Allen

      Comment

      • MLH

        #4
        Re: error #3259? A97

        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?

        Comment

        • Allen Browne

          #5
          Re: error #3259? A97

          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:
          Reference for the field types in a Microsoft Access database, matching the names in the Access interface, the names in DDL queries, the DAO constants, and the ADOX constants.

          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@NorthStat e.netwrote in message
          news:3tigf2t3o8 j1u9lpoj117cpgm onss17gur@4ax.c om...
          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?

          Comment

          Working...