C
Crazy Fool
Hi folks - I'm trying to insert a row into an Access table
using the following:
INSERT INTO Files (FileID, FileName, FilePath, FileType,
FileSize, DiskID) VALUES
(SELECT Max(Files.FileID)+1 AS Expr1
FROM Files
, 'HOLIDAY.XLT', 'N:\CALC', 'Microsoft Excel
5.0 Worksheet', 499712, 0
This tells me there's a syntax error in the SELECT MAX
part. I've simplified it to this:
INSERT INTO Files (FileID) VALUES
(SELECT Max(Files.FileID)+1 AS Expr1 FROM Files
which gives the same error. But the select statement on
its own works fine:
SELECT Max(Files.FileID)+1 AS Expr1
FROM Files;
I'm sure I am being a complete idiot and missing something
glaringly obvious. Could someone please put me out of my
misery?!
Thanks.
using the following:
INSERT INTO Files (FileID, FileName, FilePath, FileType,
FileSize, DiskID) VALUES
(SELECT Max(Files.FileID)+1 AS Expr1
FROM Files

5.0 Worksheet', 499712, 0
This tells me there's a syntax error in the SELECT MAX
part. I've simplified it to this:
INSERT INTO Files (FileID) VALUES
(SELECT Max(Files.FileID)+1 AS Expr1 FROM Files

which gives the same error. But the select statement on
its own works fine:
SELECT Max(Files.FileID)+1 AS Expr1
FROM Files;
I'm sure I am being a complete idiot and missing something
glaringly obvious. Could someone please put me out of my
misery?!
Thanks.