var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: DateAdd Need Help Very Bad
Im new here and to programming, I have a project and I would like to know how I can make DateAdd function to get the interval value (number) from a table and save the result to a table.
DATEADD(<date/time_part>, <number>, <date>)
Sample : =DateAdd("m",4,[hdate])
Do you mean storing the result of the DateAdd function applied to each row from a table into a column of another table, or retrieve the date from a single row, use it with DateAdd and store the result? If you prefer: is it for a single date value (one row) or for every row of a table (or a subset of these rows)?
Have a nice day!
retrieve the date from a single row use it with dateadd and store the result, it is for every row of the table
i have 20 sample data with hiredate and want them to automatically show their tentative leave date after 4 months (future date) using dateadd and store the result in a table.
You can use a query, which is faster than VBA.
1. If the computed values must be stored in the same table as the original value:
2. If the computed values must be stored in existing rows of another table:
SET Tbl_Src_Dest.Field_Date_Dest = DateAdd("m", 4, Tbl_Src_Dest.Field_Date_Src);
3. If the computed values must be stored in new rows of the destination table:
UPDATE Tbl_Source INNER JOIN
SET Tbl_Destination.Field_Date = DateAdd("m", 4, Tbl_Source.Field_Date);
Also notice that storing computed values into tables it is not recommended: sooner or later this will create data incoherences.
INSERT INTO Tbl_Destination ( Field1, Field_Date )
SELECT Tbl_Source.Field1, DateAdd("m", 4, Tbl_Source.Field_Date)
Have a nice day!