Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    254
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Syntax error of Insert into statement (Access 2000)

    I receive an error called " Syntax error of Insert into statement."
    can somebody help me ?
    What i am trying is to insert the number 1987742 into the field affiliates of the table bank:

    Dim STrSQL As String
    STrSQL = " Insert INTO bank SET affiliates = 1987742"
    CurrentDb.Execute STrSQL

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Syntax error of Insert into statement (Access 2000)

    Please check your SQL book. INSERT INTO appends a new record to a table; SET is used in an update query to modify the value of a field in an existing record.

    Which of the two do you want: insert a new record or update an existing record?

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Syntax error of Insert into statement (Access 2000)

    INSERT INTO will add a record to the table. Is that what you intended? The usual syntax is INSERT INTO tablename ( fieldname) SELECT somevalue, which would make your statement:

    INSERT INTO bank ( affiliates ) SELECT 1987742

    However, if you are trying to *update* a field in the table, you don't use INSERT INTO.,
    Charlotte

Posting Permissions

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