Results 1 to 7 of 7

Thread: Excel - Querytable - SQL

Threaded View

  1. #7
    Addicted Member
    Join Date
    Mar 2009
    Posts
    157

    Re: Excel - Querytable - SQL

    Where do you have your SQL? Is it saved in a variable within a VBA module, or is it just a query in MS Query, or... ?

    Also, as for the syntax of your SQL, I think you have some extra parenthesis and some misplaced parenthesis.

    I think your SQL should probably be:
    Code:
    SELECT	* 
    FROM	PRDADMIN_EVENT
    WHERE	(PRDADMIN_EVENT.EVENTTYPEID	="RNDZ") 							AND 
    	(PRDADMIN_EVENT.DESCRIPTION	="Reply Received - Outstanding = 0")				AND
    	(
    		PRDADMIN_EVENT.DATEEVENT	BETWEEN (DateAdd('d', -1, Date) + #7:00:00#)	AND
    							(DateAdd('d', -1, Date) + #20:00:00#) 
    	);
    Or, in one line:
    Code:
    SELECT * FROM PRDADMIN_EVENT WHERE (PRDADMIN_EVENT.EVENTTYPEID	="RNDZ") AND (PRDADMIN_EVENT.DESCRIPTION="Reply Received - Outstanding = 0") AND (PRDADMIN_EVENT.DATEEVENT BETWEEN (DateAdd('d', -1, Date) + #7:00:00#) AND (DateAdd('d', -1, Date) + #20:00:00#));
    Last edited by elleg; Jun 25th, 2009 at 09:39 AM. Reason: fixed typo

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