How to Using DateAdd in querys

M

Marc

Hi,
Could someone help me with next problem,

first table with start dates and days to add

ID Name StartDate Days
5 Louise 11-jul-08 2
2 Robert 03-nov-08 9
5 Bram 14-nov-08 5



The query need to generate the new dates like below


ID Name StartDate
5 Louise 11-jul-08
5 Louise 12-jul-08
2 Robert 13-jul-08
2 Robert 14-jul-08
2 Robert 15-jul-08
2 Robert 16-jul-08
2 Robert 17-jul-08
2 Robert 18-jul-08
2 Robert 19-jul-08
2 Robert 20-jul-08
2 Robert 21-jul-08
5 Bram 14-nov-08
5 Bram 15-nov-08
5 Bram 16-nov-08
5 Bram 17-nov-08
5 Bram 18-nov-08


Many thanks in advance

Marc.
 
L

Lord Kelvan

i do hope that is a typo an no one has a duplicate id

regardless as far as i can tell you will need to use a form and some
vba because you are trying to create something from nothing

the only way to do it in a query that i can think of would be to have
a table that lists all dates and then use a query like

SELECT daystoaddtable.id, daystoaddtable.name,
listofdatestable.thedate
FROM daystoaddtable, listofdatestable
WHERE (((listofdatestable.thedate) Between [startdate] And DateAdd("d",
[days],[startdate])-1));

hope this helps

Regards
Kelvan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top