SQL Date Inbetween Statement

Results 1 to 2 of 2

Thread: SQL Date Inbetween Statement

  1. #1
    Join Date
    Dec 1969

    Default SQL Date Inbetween Statement

    Hello,<BR>I am trying to set up something where I can list all events that occur between current date + 7 days. Basically a 7 day outlook. This is what I have so far but have been unsuccessful. I get lost trying to write an inbetween statement or something. Any suggestions would be greatly appreciated. Thanks,<BR><BR>SQL = "SELECT * FROM tProjectEvents WHERE ClientID = " & objCRs("ClientID") & " AND Date =#" Date()& "#"<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: SQL Date Inbetween Statement

    You can either do<BR><BR>WHERE recDate &#060;= #6/19/2000# AND recDate &#062;= #6/12/2000#<BR><BR>or <BR><BR>WHERE recDate BETWEEN 6/19/2000# AND #6/12/2000#<BR><BR>One note for the future: *ONLY* MS Access uses the #...# notation for literal dates. So far as I know, all other DBs use &#039...&#039 (same as any other string).<BR><BR>And one more note: It is *VERY* bad practice to use keywords as the names of fields. You are using "Date" as the name of a field in your tProjectEvents table. Much better would be to name it something like "eventDate" and avoid possible conflicts.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts