General discussion

  • Creator
    Topic
  • #2079553

    ASP, SQL, & ACCESS question

    Locked

    by joel m ·

    I’ve asked this question before in this forum, but I got one reply (which only answered half my question), and I pressed the wrong button and closed the question…so here it goes again.

    I need to know how to create a table for a microsoft Accessdatabase that includes the following tables…
    1. a memo field
    2. an autonumber field

    I already know the basic syntax for the SQL statement…it’s something like:

    CREATE TABLE persons (name char(20), age integer)

    but I just don’t know howto make those 2 data types…

    thanks in advance again

    Joel
    jdm.4mg.com

All Comments

  • Author
    Replies
    • #3773253

      ASP, SQL, & ACCESS question

      by aon ·

      In reply to ASP, SQL, & ACCESS question

      The following works as you require – its in DAO.

      – Allen.

      Dim mydbs As Database
      Dim tblNew As TableDef, Field01 As Field, Field02 As Field
      Dim idx As Index, FieldIndex As Field
      ‘ Return reference to current database, or create new one if you wish
      Set mydbs = CurrentDb
      ‘ Create new table with two fields.
      Set tblNew = mydbs.CreateTableDef(“MyNewTable”)
      Set Field01 = tblNew.CreateField(“RecordID”, dbLong)
      Field01.Attributes = Field01.Attributes+ dbAutoIncrField
      ‘Set Field02 = tblNew.CreateField(“MyName”, dbText, 50)
      Set Field02 = tblNew.CreateField(“MemoF”, dbMemo, 0)
      ‘ Append fields.
      tblNew.Fields.Append Field01
      tblNew.Fields.Append Field02
      ‘ Create primary key index.
      Set idx = tblNew.CreateIndex(“PrimaryKey”)
      Set FieldIndex = idx.CreateField(“RecordID”, dbLong)
      ‘ Append index fields.
      idx.Fields.Append FieldIndex
      ‘ Set Primary property.
      idx.Primary = True
      ‘ Append index.
      tblNew.Indexe

    • #3773252

      ASP, SQL, & ACCESS question

      by amieveryours ·

      In reply to ASP, SQL, & ACCESS question

      Create Table dbo.t_forums
      (
      forum_id int Not Null Identity (1, 1),
      forum_name varchar(50) Not Null,
      forum_desc varchar(255) Not Null,
      forum_update datetime Null
      )
      identity is the same as autonumber,
      the parametere 1,1 after it isfor what number you what it to start at and how much you want it to increment everytime. there is no memo in sql, you must use varchar(500) would be good for a memo.

Viewing 1 reply thread