Results 1 to 6 of 6

Thread: SQL syntax error. should be simple...

  1. #1
    Behemoth
    Guest

    SQL syntax error. should be simple...

    Code:
    INSERT INTO tblDiary ( Year, Month, Day, Time, Event, Venue,
    Details) 
    VALUES('1976','12','03','10pm','strEvent','strVenue','strDetails')
    why is this giving a syntax error please?
    PS all fields are text fields, field names have been checked. These are not variables, 'cos I wanted to check the SQL...

    Ta

  2. #2
    Fanatic Member Jerry Grant's Avatar
    Join Date
    Jul 2000
    Location
    Dorset, UK
    Posts
    810
    Check that the column names are not 'Reserved words' in the database you are using. If they are then use alternative column names or wrap in square brackets as follows:
    Code:
    INSERT INTO tblDiary ( [Year], [Month], [Day], [Time], Event, Venue, Details) VALUES ('1976','12','03','10pm','strEvent','strVenue','strDetails')
    Hope this helps
    Jerry Grant................tnarG yrreJ
    Website: <JG-Design></.net>
    Email: [email protected]
    Working towards a bug free world......
    (Not a Microsoft employee)

  3. #3
    Behemoth
    Guest
    Thank you. That was it exactly...Is there a list of reserved words for reference anywhere?

  4. #4
    Behemoth
    Guest
    Tom says thanks too

  5. #5
    Fanatic Member Jerry Grant's Avatar
    Join Date
    Jul 2000
    Location
    Dorset, UK
    Posts
    810
    Access 2000 reserved word list......
    -A
    ADD
    ALL
    Alphanumeric
    ALTER
    AND
    ANY
    Application
    AS
    ASC
    Assistant
    AUTOINCREMENT
    Avg
    -B
    BETWEEN
    BINARY
    BIT
    BOOLEAN
    BY
    BYTE
    -C
    CHAR, CHARACTER
    COLUMN
    CompactDatabase
    CONSTRAINT
    Container
    Count
    COUNTER
    CREATE
    CreateDatabase
    CreateField
    CreateGroup
    CreateIndex
    CreateObject
    CreateProperty
    CreateRelation
    CreateTableDef
    CreateUser
    CreateWorkspace
    CURRENCY
    CurrentUser
    -D
    DATABASE
    DATE
    DATETIME
    DELETE
    DESC
    Description
    DISALLOW
    DISTINCT
    DISTINCTROW
    Document
    DOUBLE
    DROP
    -E
    Echo
    Else
    End
    Eqv
    Error
    EXISTS
    Exit
    -F
    FALSE
    Field, Fields
    FillCache
    FLOAT, FLOAT4, FLOAT8
    FOREIGN
    Form, Forms
    FROM
    Full
    FUNCTION
    -G
    GENERAL
    GetObject
    GetOption
    GotoPage
    GROUP
    GROUP BY
    GUID
    -H
    HAVING
    -I
    Idle
    IEEEDOUBLE, IEEESINGLE
    If
    IGNORE
    Imp
    IN, In
    INDEX
    Index, Indexes
    INNER
    INSERT
    InsertText
    INT, INTEGER, INTEGER1, INTEGER2, INTEGER4
    INTO
    IS, Is
    -J
    JOIN
    -K
    KEY
    -L
    LEFT
    Level
    Like
    LOGICAL, LOGICAL1
    LONG, LONGBINARY, LONGTEXT

    -M
    Macro
    Match
    Max, Min, Mod
    MEMO
    Module
    MONEY
    Move
    -N
    NAME
    NewPassword
    NO
    Not
    NULL
    NUMBER, NUMERIC
    -O
    Object
    OLEOBJECT
    OFF
    ON
    OpenRecordset
    OPTION
    OR, Or
    ORDER
    Outer
    OWNERACCESS
    -P
    Parameter
    PARAMETERS
    Partial
    PERCENT
    PIVOT
    PRIMARY
    PROCEDURE
    Property
    -Q
    Queries
    Query
    Quit
    -R
    REAL
    Recalc
    Recordset
    REFERENCES
    Refresh
    RefreshLink
    RegisterDatabase
    Relation
    Repaint
    RepairDatabase
    Report
    Reports
    Requery
    RIGHT
    -S
    SCREEN
    SECTION
    SELECT)
    SET
    SetFocus
    SetOption
    SHORT
    SINGLE
    SMALLINT
    SOME
    SQL
    StDev, StDevP
    STRING
    Sum
    -T
    TABLE
    TableDef, TableDefs
    TableID
    TEXT
    TIME, TIMESTAMP
    TOP
    TRANSFORM
    TRUE
    Type
    -U
    UNION
    UNIQUE
    UPDATE
    -V
    VALUE
    VALUES
    Var, VarP
    VARBINARY, VARCHAR
    -W
    WHERE
    WITH
    Workspace
    -X
    Xor
    -Y
    Year
    YES
    YESNO


    The following symbols should not be used as part of a field name:

    .
    /
    *
    :
    !
    #
    &amp;
    -
    ?
    Jerry Grant................tnarG yrreJ
    Website: <JG-Design></.net>
    Email: [email protected]
    Working towards a bug free world......
    (Not a Microsoft employee)

  6. #6
    Behemoth
    Guest
    phew! cheers pal.

    Hope you have a good weekend...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width