Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dates and Times

Status
Not open for further replies.

andrew31639

Technical User
Apr 9, 2004
3
0
0
US
Hey guys. For a website I'm working on, I need the visitors to be able to select appointments from an Access database. Is there an easy way to create a table with dates and times, say for 2 years in 15 minute increments for Mondays through Fridays? I know there has to be an easy way to do this. If not, that sure will be a lot of data entry. I'm not too advanced, so if you can give me as many details as possible that would be great. Thanks.

Andy
 
Hi,
Not sure if this would work for you, but you could use the drag down handle to fill your dates and times in Excel and import as a table into Access. Not very sofistocated but it may be the quickest way with the least data entry.

Good luck

Patrick
 
You could write a bit of VBA code
[blue][tt]
Public Sub LoadTimes(DStart As Date, DEnd As Date, Increment As Integer)
Dim n As Long
Dim DT As Date
Dim DX As Date

DT = DStart
Do Until DT = DEnd
If Weekday(DT) <> vbSaturday And Weekday(DT) <> vbSunday Then
For n = 0 To (1440 / Increment)
DX = DateAdd("n", Increment * n, DT)
CurrentDb.Execute "INSERT INTO tblTimes (ApptTime) VALUES (#" & DX & "#) "
Next n
End If
DT = DateAdd("d", 1, DT)
Loop

End Sub
[/tt][/blue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top