Please help me correct the following query:
SQL = \"insert into tblContract (Empid, Start1, Finish1, Store1, \" & _
\"Start2, Finish2, St
You need to re-write your VALUES
clause as a SELECT
query.
You have seven columns in your INSERT
clause and eight in your VALUES
clause. From the column names I guess your subquery
select max(testid) FROM tbltesting
is missing a destination. Guessing it may be called starting_testid
; also guessing data types (Access database engine ANSI-92 Query Mode syntax):
CREATE PROCEDURE AddContract
(
:Empid INTEGER,
:Start1 DATETIME,
:Finish1 DATETIME,
:Store1 VARCHAR(20),
:Start2 DATETIME,
:Finish2 DATETIME,
:Store2 VARCHAR(20)
)
AS
insert into tblContract
(
Empid, starting_testid,
Start1, Finish1, Store1,
Start2, Finish2, Store2
)
SELECT :Empid, max(testid),
:Start1, :Finish1, :Store1,
:Start2, :Finish2, :Store2
FROM tbltesting;