Derek and ehwagner

Both of your versions worked wonderfully. Thank you so much. Its interesting to see where I went wrong with the scripting and how the few changes can make a big difference.

Thanks again so much!

I tried replacing the script however it comes back with an undeclared identifier sCurrentDate. How do I need to declare that? I have decided to upload my program to see if anyone could figure this out. Maybe I am just doing it wrong.

Any advice is greatly welcomed.

I am trying to add the current DateTime to database field when updating an entry. I originally tried to do it with a date time picker but it wouldn't automatically pull the current datetime. So I switched to trying my hand a scripting. I wrote this one here with the help of many other articles but after I close the form it updates all entries in my database not just the one I am working on. I know I am missing something but I am not super knowledgeable about Delphi. I know it must be missing a WHERE statement or some var function, but I cannot figure it out. Any help will be greatly appreciated.

My code:
procedure frmPatient_OnClose (Sender: string; Action: string);
begin
SQLExecute('UPDATE patient SET date_updated = "' + FormatDateTime('yyyy-mm-dd hh:mm:ss.zzz', Now) + '" ');
end;

begin
end.