what causes a syntax error in an insert or update statement?

although you can select records no problem, can use insert and update in other databases you sometimes might get an error like the following

the error message basically states that the ODBC driver cannot understand the SQL statement. this is usually caused by an invalid name for the table or column you want to insert into or which you want to update.

databases like Access are quite permissive when it comes to naming conventions. you can call your columns almost anything you like. but this will not always work with plain SQL.

 

here are some rules you should follow when designing the database:

- don't use more than one word for names (wrong: "my field", ok: "myfield")

- don't use special characters apart from underscores, not even dashes (wrong: "my-field", "myfield:", anything with umlauts or other special language characters, ok: "my_field")

- don't use numbers, always start with a letter (wrong: "1", ok: "f1")

- don't use reserved words (= words that have special functions in SQL like ORDER, FROM, WHERE, ASC, LIKE, DATE,.... if you look up the scaalcoffee.mdb you will see that all columns are named something like fID, fCity, fAdress or PRTitle, PRCopy etc. this is good practise because it assures that you have really unique names.)

 

1