Hello, I'm trying to work with a access database and have found that, if possible, if exists sql structure would be easier then implementing the same logic in vbscript with many unique SQL statements (one statement vs many). However, when I try to do the "IF EXISTS (SELECT...) UPDATE ... ELSE INSERT INTO ..." construct access gives the error in the title and highlights the IF part of the statement. How does access expect this construct to be formatted? Thanks.
P.S. I'm using Access 2007 with a access 2002 compatible db for use with asp
IF EXISTS is not valid in Access, the Jet Engine does not recognise it. You can use COUNT(*) (in SQL) or the DCount() function (in VBA). Also notice that you cannot create conditional structures (IF ... ELSE) in an Access Query, the only exception being the IIf() function.