I have a delima. I am building a database that is date driven
I am trying to do a work que so that, specific records due on a specific date it will appear in the form.
I need to be able to have a query, table, or macro that will automatically populated records with due dates by the click of a command button.
For instance if a project started on 1/01/06 and ended on 02/01/06. I need the system to create 4 records stating week 1 , week 2, week 3, and week 4 in a field,
Is there a macro I can build that will automatically populate these records for me in a table without manually inputting each week?
datediff differance between to dates
dateadd add a number of day,week,months to a date
Sub test(StartDate, EndDate)
Dim Week_Count As Long
Dim WeekSart As Date
Dim WeekMark As Long
Dim rst As Recordset
Dim DB As Database
Set DB = CurrentDb
Set rst = DB.OpenRecordset("TABLENAME")
Week_Count = DateDiff("ww", StartDate, EndDate)
For WeekMark = 1 To Week_Count
WeekSart = DateAdd("d", WeekMark * 7, StartDate)
rst.Fields("fieldname1") = WeekSart
rst.Fields("fieldname2") = "bla"
rst.Fields("fieldname3") = "More BLA"
rst.Fields("fieldname4") = "and some more"
Once you have edirt the Feildname
you should beable to just pass the
hope this help
See clear as mud
the aim is store once, not store multiple times
Remember... Optimize 'til you die!
Progaming environment: Access based on my own environment: DAO3.6/A97/A2000/A2003/A2007/A2010 VB based on my own environment: vb6 sp5 ASP based on my own environment: 5.6 VB-NET based on my own environment started 2007 SQL-2005 based on my own environment started 2008 MYLE YOUR PASSWORD IS JUST LIKE YOUR TOOTHBRUSH DON'T SHARE IT.