creatin a table using access query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ERI1618
    New Member
    • Nov 2006
    • 4

    #1

    creatin a table using access query

    I am trying to create a table in Access but i have a syntax error:

    I just want to crate a table with default values for excample

    create table test (column1 Text(20) DEFAULT 'This is a test')

    I know it works in SQL.
    Thanks in advance for the help.
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    Originally posted by ERI1618
    I am trying to create a table in Access but i have a syntax error:

    I just want to crate a table with default values for excample

    create table test (column1 Text(20) DEFAULT 'This is a test')

    I know it works in SQL.
    Thanks in advance for the help.
    'I don't think that you can accomplish this directly in Access, but his will work

    Dim MyDB As Database
    Set MyDB = CurrentDb()

    MyDB.Execute "CREATE TABLE TestTable (FirstName TEXT(50), LastName TEXT(125))"

    MyDB.Close

    CurrentDb.Table Defs("TestTable ").Fields("Last Name").DefaultV alue = "Smith"

    Comment

    • ERI1618
      New Member
      • Nov 2006
      • 4

      #3
      Thank you it worked.

      Comment

      Working...