Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!
  1. Monthly (Recurring) Target: $300 :: Achieved: $95
      Become a Supporter    ::   Make a Contribution   

how can I know table def language for existed table in access

Discussion in 'Information Technology' started by Jack Wang, Jul 28, 2006.

  1. Jack Wang

    Jack Wang
    Expand Collapse
    Guest

    in my access file, there's a table A which created using Design View, and it
    has some fields, what I want to know is that the table definition language
    for table A
    like 'create table A ...'
     
  2. Loading...

    Similar Threads Forum Date
    Controversial Retribution in Sikhism: Is it acceptable in self-defense? Hard Talk Aug 12, 2012
    Sikh News Cong defers plans to table Nanavati report (NDTV) Breaking News May 7, 2005
    As A Child, Public Marches Of Sikhism Made Me Uncomfortable. They Still Do . Why ? Whats The Logic Hard Talk Oct 16, 2016
    Arts/Society Backyard Vegetable Garden Language, Arts & Culture Dec 27, 2013
    Heritage Now a Vegetable Market, Ranjit Singh's Royal Haveli a Picture of Neglect History of Sikhism Nov 11, 2013

  3. Allen Browne

    Allen Browne
    Expand Collapse
    Guest

    The example below shows the basic syntax, and most of the field types and
    options available.

    Some of those options work only if you execute the DDL query under ADO, i.e.
    they do not work if you try running them from the query window.

    For a reference comparision between the names to use in DDL and the names in
    the table design window and other contexts, see this table:
    Field type names (JET, DDL, DAO and ADOX)
    at:
    http://allenbrowne.com/ser-49.html

    Ultimately, the CREATE TABLE approach is useless in Access, because there
    are basic field properties you canot set. For example, it is crucial to set
    Allow Zero Length properties for Text field, but you can't do that with DDL.
    As a result, you really have to use DAO methods such as CreateTableDef and
    CreateField.

    Anyway, here's what can be done with DDL:

    Sub CreateTableDDL()
    Dim cmd As New ADODB.Command
    Dim strSql As String

    cmd.ActiveConnection = CurrentProject.Connection
    strSql = "CREATE TABLE tblDdlContractor " & _
    "(ContractorID COUNTER CONSTRAINT PrimaryKey PRIMARY KEY, " & _
    "Surname TEXT(30) WITH COMP NOT NULL, " & _
    "FirstName TEXT(20) WITH COMP, " & _
    "Inactive YESNO, " & _
    "HourlyFee CURRENCY DEFAULT 0, " & _
    "PenaltyRate DOUBLE, " & _
    "BirthDate DATE, " & _
    "Notes MEMO, " & _
    "CONSTRAINT FullName UNIQUE (Surname, FirstName));"
    cmd.CommandText = strSql
    cmd.Execute
    End Sub

    --
    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.

    "Jack Wang" <Jack Wang@discussions.microsoft.com> wrote in message
    news:43815739-622F-4BB0-B2F1-AE26132D8177@microsoft.com...
    > in my access file, there's a table A which created using Design View, and
    > it
    > has some fields, what I want to know is that the table definition language
    > for table A
    > like 'create table A ...'
     
Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     



Share This Page