Topic: Automatically increment a date field
Hello everyone
I would like to automatically increment the date of a 30-day date field in another Date field.
How do you do it?
Thank you
My Visual Database → General → Automatically increment a date field
Hello everyone
I would like to automatically increment the date of a 30-day date field in another Date field.
How do you do it?
Thank you
With a sql script:
insert into table2 (column_month+1) values (select date("column_date", '+1 month') from table1 where id=id_number)
The destination table must match the type of the source regarding Date or Datetime.
You may have to tinker a bit with the date format
Hello Reteinformatica, Thierry
Another way to approach the problem: in the attached example, the second date field is automatically set to be 30 days ahead of the first date field; this is done with a small (1 line) script.
Is this the sort of thing you were meaning? Even if not, it shows one approach you could take.
Regards,
Derek.
Thanks to anwer,
sorry but I'm not an expert of languages code. Where I have to put that script?
Unfortunately I have using the last free version, it didn't open me your project derek.
Which version are you using reteinformatica?
Nice and sweet Derek, I like your elegant solution!
I'm using 1.44, the last freeware
The last free version was 1.46!!
I downloaded it from Database For Beginners Book inside link, in the help it's Witten 1.44
Never mind, I have re-made Derek's example using the version 1.44
It is super easy to understand.
Hello everyone
And thank you for all the help you're giving me. I modified the script to adjust it to my project so
procedure frmFornitore_dtData_OnChange (Sender: TObject);
begin
frmFornitore.dtScadenza.date := frmFornitore.dtData.date + 30;
end;
begin
end.
Unfortunately id does not work and I can not understand why.
If someone has patience I am attaching my project.
Thanks again to all
When you implement a procedure in a script, you must affect that procedure to an event on an object.
Like this:
Well, thank you very much, that was the passage I missed, thanks to Derek for the script and all those who responded. Now it works well.
My Visual Database → General → Automatically increment a date field
Powered by PunBB, supported by Informer Technologies, Inc.
Theme Hydrogen by Kushi