Howdy, I'm trying to send information to a table that the user wants deleted. I just want to make sure I save the data to a different table before he/she deletes it. I keep getting a syntax error but I'm not even sure if I can perform the transaction the way I'm doing it. If anyone can give me a pointer I'd appreciate it!!
'Need to send the information to the deleted table
strSQL = "INSERT INTO tbldeletedinfo([INCR],[Date Entered],[Planner],[BU],[Material Number],[Material Description],"
strSQL = strSQL & "[Quantity],[PO Number],[Supplier],[Reason][Approver],[Comments],[Cost],[Type],[Cost Center],"
strSQL = strSQL & "[Mode],[Prepaid/Collect])"
strSQL = strSQL & " SELECT " _
& "[tblhistory].[INCR]," _
& "[tblhistory].[Date Entered]," _
& "[tblhistory].[Planner]," _
& "[tblhistory].[BU]," _
& "[tblhistory].[Material Number]," _
& "[tblhistory].[Material Description]," _
& "[tblhistory].[Quantity]," _
& "[tblhistory].[PO Number]," _
& "[tblhistory].[Supplier]," _
& "[tblhistory].[Reason]," _
& "[tblhistory].[Approver]," _
& "[tblhistory].[Comments]," _
& "[tblhistory].[Cost]," _
& "[tblhistory].[Type]," _
& "[tblhistory].[Cost Center]," _
& "[tblhistory].[Mode]," _
& "[tblhistory].[Prepaid/Collect]" _
& " FROM tblhistory WHERE([INCR]=" & lngResult & ");"
MsgBox strSQL
DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
DoCmd.SetWarnings True
'Need to send the information to the deleted table
strSQL = "INSERT INTO tbldeletedinfo([INCR],[Date Entered],[Planner],[BU],[Material Number],[Material Description],"
strSQL = strSQL & "[Quantity],[PO Number],[Supplier],[Reason][Approver],[Comments],[Cost],[Type],[Cost Center],"
strSQL = strSQL & "[Mode],[Prepaid/Collect])"
strSQL = strSQL & " SELECT " _
& "[tblhistory].[INCR]," _
& "[tblhistory].[Date Entered]," _
& "[tblhistory].[Planner]," _
& "[tblhistory].[BU]," _
& "[tblhistory].[Material Number]," _
& "[tblhistory].[Material Description]," _
& "[tblhistory].[Quantity]," _
& "[tblhistory].[PO Number]," _
& "[tblhistory].[Supplier]," _
& "[tblhistory].[Reason]," _
& "[tblhistory].[Approver]," _
& "[tblhistory].[Comments]," _
& "[tblhistory].[Cost]," _
& "[tblhistory].[Type]," _
& "[tblhistory].[Cost Center]," _
& "[tblhistory].[Mode]," _
& "[tblhistory].[Prepaid/Collect]" _
& " FROM tblhistory WHERE([INCR]=" & lngResult & ");"
MsgBox strSQL
DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
DoCmd.SetWarnings True