Hi
I'm having trouble displaying time, Access is taking my time and adding the date to it...as Jan 1 1900
What I am doing is taking a selected date ( from form), and then for that date I am generating time slots using a starting value of 7:30 and adding 1 hour by looping 15 times. visually in the query result it looks OK, but if I click the field the calender pops up and I can see the older date ( 1900)...also if I export to Excel it displays as a date.
also tried.....
StTime = TimeValue(Format(#7:30:00 AM#, "HH:nn:SS"))
StTime = TimeSerial(7, 30, 0)
I'm having trouble displaying time, Access is taking my time and adding the date to it...as Jan 1 1900
What I am doing is taking a selected date ( from form), and then for that date I am generating time slots using a starting value of 7:30 and adding 1 hour by looping 15 times. visually in the query result it looks OK, but if I click the field the calender pops up and I can see the older date ( 1900)...also if I export to Excel it displays as a date.
Code:
Public Sub Update()
Dim strSql As String
Dim stDate As Date
Dim x As Integer
Dim StTime As Date
Dim EnTime As Date
StTime = Format(#7:30:00 AM#, "HH:MM:SS")
EnTime = #7:30:00 PM#
stDate = Me.txtDate
DoCmd.OpenQuery "qryDelete_TimeSlot"
For x = 1 To 15
'Do Until StTime = #7:30:00 PM#
strSql = "insert into tblTimeSlot(CurrDate,TimeSlot)"
strSql = strSql + "Values(" & "#" & stDate & "#" & "," & "'" & StTime & "'" & ")"
DoCmd.RunSQL strSql
StTime = StTime + "01:00"
'Loop
Next x
Me.Requery
also tried.....
StTime = TimeValue(Format(#7:30:00 AM#, "HH:nn:SS"))
StTime = TimeSerial(7, 30, 0)
Attachments
Last edited: