I'm using D2007 and trying to add a new, blank record to my Access database with code. The DB has a 'day' field and a 'event' field. All works fine when a record exists for the given day. I need to learn how to add a record to the file with day=NewKey when that record doesn't exist in the file.
Here's what I've got so far:
// e.g. NewKey = '"2008-06-18"';
SQL := 'SELECT Event FROM Events ' + ' WHERE Day = ' + NewKey;
rs := CoRecordset.Create;
rs.CursorLocation := adUseClient;
rs.Open(SQL, cnn, adOpenDynamic, adLockPessimistic, adCmdTableDirect);
if not rs.EOF then
DayEvent := VarToStr(rs.Fields.Item['Event'].Value)
else begin
??????
end;