OS = Microsoft Windows 2000 Professional
I'm querying a mainframe AS400 database to download to an Excel 2002 spreadsheet. The following works fine until I add the IIf statement. Error message in Excel VBA simply says syntax error, however when I run it in Access 2002 (Service Pack 2) gives the error:
[IBM]Client Access Express ODBC Driver(32Bit)[DB2/400 SQL]SQL0199
keyword BETWEEN not expected Valid tokens,.(#199) Substituting any other operator =,< gets an error SQL0104 Token = was not Valid. Any Suggestions?
vQuery = "SELECT PSPSP100.PARNT, PSPSP100.CSEQN, PSPSP100.CHILD, MSPMP100.PRDNO, MSPMP100.DESCP FROM ------------- WHERE MSPMP100.PRDNO = PSPSP100.CHILD AND IIf(PSPSP100.PSPCL Between 'AA' And 'YM',MSPMP100.S2APH='C10301A',MSPMP100.S2APH Like '*') ORDER BY PSPSP100.PARNT, PSPSP100.CSEQN"
I'm querying a mainframe AS400 database to download to an Excel 2002 spreadsheet. The following works fine until I add the IIf statement. Error message in Excel VBA simply says syntax error, however when I run it in Access 2002 (Service Pack 2) gives the error:
[IBM]Client Access Express ODBC Driver(32Bit)[DB2/400 SQL]SQL0199
keyword BETWEEN not expected Valid tokens,.(#199) Substituting any other operator =,< gets an error SQL0104 Token = was not Valid. Any Suggestions?
vQuery = "SELECT PSPSP100.PARNT, PSPSP100.CSEQN, PSPSP100.CHILD, MSPMP100.PRDNO, MSPMP100.DESCP FROM ------------- WHERE MSPMP100.PRDNO = PSPSP100.CHILD AND IIf(PSPSP100.PSPCL Between 'AA' And 'YM',MSPMP100.S2APH='C10301A',MSPMP100.S2APH Like '*') ORDER BY PSPSP100.PARNT, PSPSP100.CSEQN"