LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Refreshing a query with a changing date

Hi,

Need help refreshing this query, but I want to to refer to a variable
date, rather than the fixed date ('2004-05-19 00:00:00').

Ideally, If I could get it to reference a cell, say cell "a1", and I
can have users put the date in there.

Regards

David

Sheets("BTCC Query").Select
Range("A1").Select
With Selection.QueryTable
..Connection = Array(Array( _
"ODBC;DSN=CCEXREPORTS;Description=SEA MSQL
d:/sea/client;UID=*********;PWD=**********;APP=Microsoft®
Query;WSID=CC-HPC-01;Network=DBMS" _
), Array("SOCN"))
..CommandText = Array( _
"SELECT cc_Handled_Calls.RDATE, cc_Handled_Calls.ARRIVALTIME,
cc_Handled_Calls.CALL_ID, cc_Handled_Calls.MEDIATYPE,
cc_Handled_Calls.QUEUE_NAME, cc_Handled_Calls.X_COL1,
cc_Handled_Calls.DURATION, cc_H" _
, _
"andled_Calls.STATE, cc_Handled_Calls.AGENT,
cc_Handled_Calls.DATE, cc_Handled_Calls.FMINPRT,
cc_Handled_Calls.MINPRT, cc_Handled_Calls.HRPRT,
cc_Handled_Calls.HRPRTX, cc_Handled_Calls.MINPRTX, cc_Hand" _
, _
"led_Calls.FMINPRTX, cc_Handled_Calls.WEEK_NO,
cc_Handled_Calls.MONTH_NO, cc_Handled_Calls.QUARTER_NO,
cc_Handled_Calls.YEAR_NO" & Chr(13) & "" & Chr(10) & "FROM
CC_HReport.dbo.cc_Handled_Calls cc_Handled_Calls" & Chr(13) & "" &
Chr(10) & "WHERE (cc_Handled" _
, "_Calls.RDATE={ts '2004-05-19 00:00:00'})" & Chr(13) & "" &
Chr(10) & "ORDER BY cc_Handled_Calls.RDATE")
..Refresh BackgroundQuery:=False
End With
ActiveWindow.LargeScroll ToRight:=0
Sheets("Front Page").Select
Range("A1").Select
End Sub


---
Message posted from http://www.ExcelForum.com/

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Microsoft Query is changing a negative number into a date mowens Excel Discussion (Misc queries) 1 March 10th 10 06:20 PM
Refreshing an Excel Query DWIGHTBALLMORRILL Excel Discussion (Misc queries) 1 March 4th 08 06:38 PM
Refreshing Data from a web query smith_gw Excel Discussion (Misc queries) 0 April 25th 07 10:44 PM
Refreshing Pivot Tables QUery Ron McCormick[_2_] Excel Programming 1 December 3rd 03 06:31 PM
Changing fixed date with a variable in a ODBC Query Hande & Tolga Excel Programming 1 September 22nd 03 11:00 AM


All times are GMT +1. The time now is 08:57 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"