strSQL = [COLOR=#333333]"select a,b,c from d where submitted_date > " & [/COLOR][B][COLOR=#ff0000]DATE[/COLOR][/B][COLOR=#333333] & "- 30;"
DoCmd.RunSQL strSQL
[/COLOR]
Are you actually running this against an Access table or a SQL table?
strSQL = "select a,b,c from d where submitted_date > " & DATE & "- 30;"
DoCmd.RunSQL strSQL
Try this modification:
Code:strSQL = [COLOR=#333333]"select a,b,c from d where submitted_date > " & [/COLOR][B][COLOR=#ff0000]DATE[/COLOR][/B][COLOR=#333333] & "- 30;" DoCmd.RunSQL strSQL [/COLOR]
Just use:
Code:[COLOR=#333333]SELECT a,b,c FROM d WHERE submitted_date > Date() - 30;[/COLOR]
good idea - but it is evaluating as 0 in this expression - i also tried using > #" & DATE & "# - 30;" - same effect
[COLOR=#0000ff]Option Compare Database[/COLOR]
[COLOR=#0000ff]Sub[/COLOR] Test()
[COLOR=#0000ff] Dim[/COLOR] strSQL [COLOR=#0000ff]As String[/COLOR]
strSQL = "SELECT Inbox.Priority, Inbox.Subject, Inbox.From FROM Inbox WHERE submitted_date >" & Date & "-30;"
DoCmd.RunSQL strSQL
[COLOR=#0000ff]End Sub[/COLOR]
?strSQL
SELECT Inbox.Priority, Inbox.Subject, Inbox.From FROM Inbox WHERE submitted_date >5/10/2016-30;
strSQL = "SELECT Inbox.Priority, Inbox.Subject, Inbox.From FROM Inbox WHERE submitted_date > (#" & Date & "# - 30);"
?strSQL
SELECT Inbox.Priority, Inbox.Subject, Inbox.From FROM Inbox WHERE submitted_date > (#5/10/2016# - 30);