Need dates in a column

RET79

Well-known Member
Joined
Mar 19, 2002
Messages
526
What's the quick way of putting all the dates from 1/1/98 to 1/1/05 in the first column of an Access database? I don't fancy typing them all in! Thanks.
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Try this:

Code:
Function MakeDates()
Dim MyDate as Date
MyDate=Date(1998,1,1)
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Set dbs=CurrentDb()
Set rst=db.OpenRecordset("MyTable")
With rst
  .MoveFirst
  Do Until MyDate=Date(2005,1,1)
    .AddNew
    ![ThisDate]=MyDate
    MyDate=MyDate+1
    .Update
  Loop
End With
End Function
Change MyTable and ThisDate to suit.

HTH
Denis
 
Upvote 0

Forum statistics

Threads
1,221,581
Messages
6,160,630
Members
451,661
Latest member
hamdan17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top