Almost right.  I did a quick tour through the date functions and
found that DateAdd works (just like in VBA).  Your where clause would
look ike this:

WHERE (((tblNews.NewsDate) Between DateAdd("d",-30,Date()) And Date()

Cheers,

Peter

-----Original Message-----
From: Mike Belcher
[mailto:[EMAIL PROTECTED] 

Wow great idea. I did the query in access and then open the SQL view and
here is the string. 

SELECT tblNews.NewsDate, tblNews.Headline, tblNews.News,
tblNews.Signature

FROM tblNews

WHERE (((tblNews.NewsDate) Between #1/10/2005# And #2/10/2005#));

Now all I need is to replace the between dates with 2 variables that are
the strCurrentDate amd strDate30DaysAgo and it should work. That is the
last part to figure out.

strCurrentDate = Date
strDate30DaysAgo = Date - 30 // is this right?


DOES THIS LOOK CORRECT?
SELECT tblNews.NewsDate, tblNews.Headline, tblNews.News,
tblNews.Signature

FROM tblNews

WHERE (((tblNews.NewsDate) Between & "#" & '"strDate30DaysAgo"' & "#"
And "#" $ '"strCurrentDate"' % "#" & ));





 

-----Original Message-----
From: Peter Brunone [mailto:[EMAIL PROTECTED] 

   I haven't checked into this, but have you tried the Help docs in
Access?

 From: "Mike Belcher" [EMAIL PROTECTED]

WHERE (Newsdate > DATEADD(d, - 8, { fn NOW() })) AND (StartDate < '" & 

Format(Now(),"d") & "')

Okay wow I will give that a try. Wow that looks complex. I haven't
learned

much about the date functions. I guess I should find a place to read up
on

it. 

-----Original Message-----

From: BobFilipiak [mailto:[EMAIL PROTECTED] 

Try:

WHERE (Newsdate > DATEADD(d, - 8, { fn NOW() })) AND (StartDate < '" & 

Format(Now(),"d") & "')

Bob Filipiak

A question not asked

is a lost opportunity to learn.

----- Original Message ----- 

From: "Mike Belcher" 

> I have a news database that when displayed I want to list the articles

> from

> the current date to 30 days ago. How can this be done with a SQL 
> String...




 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to