Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
dim db as database
dim rs as recordset
dim intCounter as integer
dim dteMonday as date
set db=currentdb
set rs=db.openrecordset("tblYourTable",dbopendynaset)
dteMonday=#7/01/2008#
for intCounter=1 to 52
rs.addnew
rs!Year="2008"
rs!Week=intCounter
rs!MondayDate=dteFirstmonday
rs.update
dteMonday=dateadd("d",7,dteMonday)
next intCounter
rs.close
set rs=nothing
set db=nothing
msgbox("Table populated")
Sub CreateMondays()
Dim dteMon As Date
Dim db As Database
Set db = CurrentDb
dteMon = DateSerial(Year(Date), 1, 1)
If Weekday(dteMon) <> 2 Then
dteMon = dteMon + 7 - Weekday(dteMon) + 2
End If
'Create table
strSQL = "Create Table Mondays (MonYear Int,MonWeek DateTime)"
db.Execute strSQL
For i = 0 To 51
'Insert records
strSQL = "Insert Into Mondays (Monyear,MonWeek) Values (" _
& Year(Date) & ",#" & Format(DateAdd("ww", i, dteMon), "yyyy/mm/dd") & "# )"
db.Execute strSQL
Next
Debug.Print Format(DMin("MonWeek", "Mondays"), "ww d mmm")
Debug.Print Format(DMax("MonWeek", "Mondays"), "ww d mmm")
End Sub