Firsty Apologies if this is in the incorrect section.
I have a small database created in MS Access and Im trying to write a query that transfers data from one table to another after researching the topic I have come up with the following SQL Statement:
This statement works perfectly and fills the tblTest with the correct details passed from tblProducts.Code:INSERT INTO tblTest (Code, Product, DaysCover, MaxCover, InStock) SELECT Code, Product, DaysCover, MaxCover, InStock FROM tblProducts WHERE IncludeInPlanning=True AND InStock=True;
My question is I need to have a record for each day for the paticular Product, I Would like to store a Date into tblTest, The date would be required for everyday including week ends (7 Days). The Date does not come from the Products table but can be specified by the user (Start Date and End Date)
so.. each Product in tblTest will have as many records as the user specifies associated with it (one for each day of the week)
Is there any simple SQL query that do this easily?
Thanks in advance
edit: As mentioned before the user can specify the start and end date so im planning on writing a front end for the database possibly in vb.net, I will probably use two of the DateTimePicker to allow the user to select the start/end dates. after thinking about this a bit more would a loop be needed so that for each date specified, insert into the test table??
I have found some sample code from this site that can grab the value of two specified dates and store within a listbox here is the code:
Code:ListBox1.Items.Clear() Dim StartDate As DateTime = DateTimePicker1.Value.Date Dim EndDate As DateTime = DateTimePicker2.Value.Date ListBox1.Items.Add(StartDate) Dim currentDate As Date = StartDate Do currentDate = currentDate.AddDays(1) ListBox1.Items.Add(currentDate) Loop Until currentDate >= EndDate




Reply With Quote
