results for last 14 days (1 Viewer)

bbwolff

Registered User.
Local time
Today, 06:06
Joined
Oct 1, 2013
Messages
116
I'd like to get results for last x days

I'm trying to use this, but it doesn't filter the results

Code:
DoCmd.OpenForm "Overview", , , "oDate" > (Date - 14)

or more specificaly

Code:
DoCmd.OpenForm "Overview", , , "oOdd = '" & Me.cmbodd & "' and oDate" > (Date - 14)

i tried plenty of different variations with not much success
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 14:06
Joined
Jan 20, 2009
Messages
12,863
Code:
DoCmd.OpenForm "Overview", , , "oDate >" & Format(Date - 14, "\#mm\/dd\/yyyy\#")
 

MarkK

bit cruncher
Local time
Yesterday, 21:06
Joined
Mar 17, 2004
Messages
8,197
Or . . .
Code:
DoCmd.OpenForm "Overview", , , "oDate > #" & Date - 14 & "#"
. . . but maybe you are seeing that a date requires "#" as delimiters. :)
 

bbwolff

Registered User.
Local time
Today, 06:06
Joined
Oct 1, 2013
Messages
116
thanks, first one works, second calls for a syntax error
 

bbwolff

Registered User.
Local time
Today, 06:06
Joined
Oct 1, 2013
Messages
116
I'm still having problems with dates :(

I can't write a code that would select all the records with the same date as is in a textbox


Code:
set rs= currentdb.openrecordset ("SELECT * FROM tblOp WHERE odate = #" & me.tdate & "#")

I tried a lot of variations (as I'm ashamed to admit I still can't really do it) but I'm getting either syntax error or not enough parameters error.
SELECT * from tblOp WHERE odate= #" & Format(datum, "dd-mmm-yyyy") & "# "
this code gets syntax error in date... odate = #17-maj-2016".
 
Last edited:

Galaxiom

Super Moderator
Staff member
Local time
Today, 14:06
Joined
Jan 20, 2009
Messages
12,863
Try reading my previous post again. Where did you get the idea of formatting the date as "dd-mmm-yyyy" ?
 

bbwolff

Registered User.
Local time
Today, 06:06
Joined
Oct 1, 2013
Messages
116
"select * from tbl where odatsa= " & Format(Me.txtDate, "\#mm\/dd\/yyyy\#"))

funny thing, it looks the same now, must have done something wrong :(
 

Users who are viewing this thread

Top Bottom