pdvsa
asked on
Date query help
Experts, I need to modify the below.
IN plain english (notice the '-1' at the end of the strSQL. BAsically I need to update if DueDate is #Date# - 1, which is yesteday.
strSQL = "UPDATE TASKS Set DueDate = DateAdd('d', 1, DueDate) WHERE DueDate=#" & Date & "#" - 1
thanks...
Private Sub cmdAdd1Yesterday_Click()
Dim strSQL As String
strSQL = "UPDATE TASKS Set DueDate = DateAdd('d', 1, DueDate) WHERE DueDate=#" & Date & "#"
CurrentDb.Execute strSQL, dbFailOnError
IN plain english (notice the '-1' at the end of the strSQL. BAsically I need to update if DueDate is #Date# - 1, which is yesteday.
strSQL = "UPDATE TASKS Set DueDate = DateAdd('d', 1, DueDate) WHERE DueDate=#" & Date & "#" - 1
thanks...
Private Sub cmdAdd1Yesterday_Click()
Dim strSQL As String
strSQL = "UPDATE TASKS Set DueDate = DateAdd('d', 1, DueDate) WHERE DueDate=#" & Date & "#"
CurrentDb.Execute strSQL, dbFailOnError
strSQL = "UPDATE TASKS Set DueDate = DueDate+1 WHERE DueDate=Date()-1"
ASKER
OK thank you.
For either way, can I add another criteria at the end?:
can I add
strSQL = "UPDATE TASKS Set DueDate = DateAdd('d', 1, DueDate) WHERE DueDate=#" & DateAdd("d", -1, Date) & "#" & [Tasks].[status] <> "Completed"
For either way, can I add another criteria at the end?:
can I add
strSQL = "UPDATE TASKS Set DueDate = DateAdd('d', 1, DueDate) WHERE DueDate=#" & DateAdd("d", -1, Date) & "#" & [Tasks].[status] <> "Completed"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
perfect. Thank you.
Open in new window