You could put the code into the Click event procedure of a command button,
instead of as a function.
Presumably you will use [Text1 Start] and [Text2 End] as the dates for the
loop.
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Reply to group, rather than allenbrowne at mvps dot org.
Jon said:
Thank you Allen, but how to execute it by using command button
:
I have a form which contains two text box. Text1 Start and text2 End.
How
to make access input the all date between those two dates in one click
in
a table??
This sample code illustrates how to create records in tblDate.TheDate:
Function MakeDates(dtStart As Date, dtEnd As Date) As Long
Dim dt As Date
Dim rs As DAO.Recordset
Set rs = DBEngine(0)(0).OpenRecordset("tblDate")
With rs
For dt = dtStart To dtEnd
.AddNew
!TheDate = dt
.Update
Next
End With
rs.Close
Set rs = Nothing
End Function