dbTalk Databases Forums  

whatswrong?

comp.database.ms-access comp.database.ms-access


Discuss whatswrong? in the comp.database.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
 
Posts: n/a

Default whatswrong? - 05-12-2004 , 02:07 PM






does any one see anything wrong with this? I'm trying to select all records
in which it is only 30 days untill the date entered in column nextcpr. i use
format mm/dd/yyyy. it must always select the records 30 days or less,
greater than the current date.
"SELECT * FROM login WHERE nextcpr <= #"& DateAdd("d", 30, Now()) &"#"
thanks in advance for your help!




Reply With Quote
  #2  
Old   
Johnny Meredith
 
Posts: n/a

Default Re: whatswrong? - 05-13-2004 , 12:03 PM






I'm thinking the format of your date is causing the problem. Try
this:

Sub foo()
Dim str As String
str = "SELECT * FROM login WHERE nextcpr <= #" & Format(DateAdd("d",
30, Now()), "Short Date") & "#;"
Debug.Print str
End Sub

Results of Immediate window:
SELECT * FROM login WHERE nextcpr <= #6/12/2004#;

That looks like good SQL to me.

HTH,
Johnny

Reply With Quote
  #3  
Old   
Andrew Backer
 
Posts: n/a

Default Re: whatswrong? - 05-14-2004 , 12:04 PM



You can use Now()+30, since this adds days.

So... "#" & format(now+30, "Short Date") & "#".

- Andrew Backer

jjrmy1 (AT) earthlink (DOT) net wrote:

Quote:
does any one see anything wrong with this? I'm trying to select all records
in which it is only 30 days untill the date entered in column nextcpr. i use
format mm/dd/yyyy. it must always select the records 30 days or less,
greater than the current date.
"SELECT * FROM login WHERE nextcpr <= #"& DateAdd("d", 30, Now()) &"#"
thanks in advance for your help!




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.