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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert Current Date and Specified Time

Status
Not open for further replies.

primagic

IS-IT--Management
Jul 24, 2008
476
GB
I am trying to insert today's date plus an actual time into a field. I am using an SQL backend.

So basically i have. I am wondering what would appear after Date() or does the entire line need changed?

Code:
If Me.CurrentTime >= "09:00" And Me.CurrentTime <= "10:00" Then
Me.NextTaskTime = Date()+ ???
End If


 
times are represented in code #9:00# strings are "9:00"
If the control is unbounded

If Me.CurrentTime >= #09:00# And Me.CurrentTime <= #10:00# Then
Me.NextTaskTime = date + cdate(me.currenttime)
End If

If it is bound to a date field then just add.
 
It is bound to a field with a datetime datatype

So can I use:

Code:
If Me.CurrentTime >= #09:00# And Me.CurrentTime <= #10:00# Then
Me.NextTaskTime = date + cdate(#11.00#)
End If
 
I assume you meant 11:00 not 11.0

If you simply want to add a literal time to a date then
date() + #11:00#
or
date() + 11/24
will work
or the dateadd function
dateAdd("h",11,date())
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top