add sql statement code example
Example: sql add statement access
PARAMETERS LastDateToKeep DateTime;
INSERT INTO tblContactEventsHistory
(ContactID, ContactDateTime, ContactEventType, ContactNotes )
SELECT tblContactEvents.ContactID, tblContactEvents.ContactDateTime,
tlkpContactEventTypes.ContactEventTypeDescription,
tblContactEvents.ContactNotes
FROM tlkpContactEventTypes
INNER JOIN (tblContactEvents
LEFT JOIN tblContactEventsHistory
ON (tblContactEvents.ContactID = tblContactEventsHistory.ContactID)
AND (tblContactEvents.ContactDateTime =
tblContactEventsHistory.ContactDateTime))
ON tlkpContactEventTypes.ContactEventTypeID =
tblContactEvents.ContactEventTypeID
WHERE (tblContactEvents.ContactDateTime<[LastDateToKeep])
AND (tblContactEventsHistory.ContactID Is Null);