Results 1 to 5 of 5
  1. #1
    dododo is offline Novice
    Windows Vista Access 2003
    Join Date
    Jun 2011
    Posts
    26

    How to set default value in Access

    Hi all,

    I want to write sql to create table and set default value in access but i got error.

    create table tbOne
    (
    id integer primary key,
    gender char(1) default 'F'
    )

    This is my code and when i run it error: syntax error in create table statement. Please help.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Are you using the query designer?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    dododo is offline Novice
    Windows Vista Access 2003
    Join Date
    Jun 2011
    Posts
    26
    Quote Originally Posted by June7 View Post
    Are you using the query designer?
    yes, i am using query desinger in access. pls help me.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    If you are using the query designer to help build, why would there be a syntax error? Are you typing directly into SQL View?

    Review

    http://www.w3schools.com/sql/sql_create_table.asp

    http://msdn.microsoft.com/en-us/library/ms180897.aspx

    The "default 'F'" isn't working. Why do you need to do this as opposed to just creating a table manually? Do you want the ID field to be autonumber?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    dododo is offline Novice
    Windows Vista Access 2003
    Join Date
    Jun 2011
    Posts
    26
    thanks for your help.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Access Ignores Default Image Viewer
    By ianmalik in forum Access
    Replies: 2
    Last Post: 01-27-2013, 05:42 PM
  2. default value does not work at access 2005
    By newaccess in forum Forms
    Replies: 5
    Last Post: 01-18-2013, 02:51 PM
  3. Replies: 3
    Last Post: 06-29-2012, 08:58 AM
  4. Access as Default Program for Device
    By Meep in forum Forms
    Replies: 1
    Last Post: 04-13-2012, 10:40 AM
  5. Custom messages to Access' default error messages.
    By evander in forum Programming
    Replies: 1
    Last Post: 06-26-2010, 02:06 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums