Possible Duplicate:
Query Syntax error
I want insert value using the below command
DoCmd.RunSQL = "insert into tblContract(
Empid,
Start1,
Finish1,
Store1,
Start2,
Finish2,
Store2)
values ('" & Me.txtEmpNo.Value & "','"
& Me.txtContSunStart1.Value & "', '"
& Me.txtContSunFinish1.Value & "','"
& Me.txtContSunStore1.Value & "','"
& Me.txtContSunStart2.Value & "', '"
& Me.txtContSunFinish2.Value & "','"
& Me.txtContSunStore2.Value & "')"
But while inserting it should insert in the row where value of a column(testid) in the same table is max(testid) of another table.
This query not working :
SQL = " INSERT INTO tblContract (Empid,testid, Start1, Finish1, Store1, Start2, Finish2, Store2) SELECT " & Me.txtEmpNo.Value & "', MAX(testid), '" & Me.txtContSunStart1.Value & "', '" & Me.txtContSunFinish1.Value & "','" & Me.txtContSunStore1.Value & "','" & Me.txtContSunStart2.Value & "', '" & Me.txtContSunFinish2.Value & "','" & Me.txtContSunStore2.Value & "' " & "FROM tbltesting'"
I am finding an alternative for this . In ms access it gives compile error