S
Steve
I get an error when I try to run it. The error is on the
first line (Compile error - user-defined type not defined)
I understand the code but am very new to this access
environment. I put the code in a module (access 2002)
and called it Sub d(). How do I get this to run
automatically when the db opens? call it in an autoexec
macro?
Thanks Maurice
Sub d()
Dim mydb As Database
Dim myset As Recordset
Dim i
Dim firstdate As Date
Dim lastdate As Date
firstdate = Date
lastdate = Date + 14
Set mydb = CurrentDb
Set myset = mydb.OpenRecordset("table1")
For i = firstdate To lastdate
myset.AddNew
myset![BookingDate] = i
myset.Update
Next i
myset.Close
MsgBox "Date creation done..."
End Sub
first line (Compile error - user-defined type not defined)
I understand the code but am very new to this access
environment. I put the code in a module (access 2002)
and called it Sub d(). How do I get this to run
automatically when the db opens? call it in an autoexec
macro?
Thanks Maurice
Sub d()
Dim mydb As Database
Dim myset As Recordset
Dim i
Dim firstdate As Date
Dim lastdate As Date
firstdate = Date
lastdate = Date + 14
Set mydb = CurrentDb
Set myset = mydb.OpenRecordset("table1")
For i = firstdate To lastdate
myset.AddNew
myset![BookingDate] = i
myset.Update
Next i
myset.Close
MsgBox "Date creation done..."
End Sub