I need a table with dates, today's date for the next 6 month.
this is to be used in a chart as x , I have value to use for y
I tried using the below module but not sure how to start with today's date and to run for a range of 6 month (+- 183 days). The function "Date()" does not work.
Code:
Public Sub FillDates()
' Will fill a Date Field with consecutive date values.
Dim Db As DAO.Database
Dim rs As Recordset
Dim dteFrom As Date
Dim dteTo As Date
Set Db = CurrentDb
Set rs = Db.OpenRecordset("tblDates")
dteFrom = [Date()]
dteTo = DateAdd("y", 190, [Dates])
With rs
Do Until dteFrom = dteTo + 1
.AddNew
!Dates = dteFrom
.Update
dteFrom = dteFrom + 1
Loop
End With
Set Db = Nothing
Set rs = Nothing
End Sub
I have managed to build a module to created dates I require but I dont know how to execute the module called "Dates" please could you assist. Would be great if i could run it from a macro as i need to run a few other queries as well