Results 1 to 7 of 7

Thread: Excel - Querytable - SQL

Hybrid View

  1. #1
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Excel - Querytable - SQL

    Assuming you have a Where clause, this condition will check for "between 07:00:00 and 20:00:00 "yesterday" ":
    Code:
    DateField Between (DateAdd('d', -1, Date) + #7:00:00#)  And  (DateAdd('d', -1, Date) + #20:00:00#)
    ...I'm not entirely sure if DateAdd is apt for this, but it hopefully will be (it is supported by Jet, which I presume is what is used).

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    Jan 2007
    Location
    England
    Posts
    234

    Re: Excel - Querytable - SQL

    Spot on Si!

    Not in work till Thursday now, so I'll check it out then and will let you know!

    Thanks!

    Mitch

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jan 2007
    Location
    England
    Posts
    234

    Re: Excel - Querytable - SQL

    This is the string I've got when my code runs

    can see you what the error is?

    It's connects to an access database, my SQL isn't too hot!

    Is there any where I could learn more advanced stuff like this?


    Code:
    SELECT * FROM PRDADMIN_EVENT WHERE (((PRDADMIN_EVENT.EVENTTYPEID)="RNDZ") AND ((PRDADMIN_EVENT.DATEEVENT) Between (DateAdd('d', -1, Date) + #7:00:00#)  And  (DateAdd('d', -1, Date) + #20:00:00#) AND ((PRDADMIN_EVENT.DESCRIPTION)="Reply Received - Outstanding = 0"));

Posting Permissions

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



Click Here to Expand Forum to Full Width