View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Jason Jason is offline
external usenet poster
 
Posts: 367
Default input the date range for update Pivot table

Hi Patrick,

Where can I place the following statement ?
macro?

Best regards,
Jason

"Patrick Molloy" wrote:

you'll have some SQL which includes the parameters?
so we have two place holders (aka tokens) in the textual SQL query string
eg

sSQL =
"SELECT {...fields etc } FROM { blah } WHERE ( MYDATE '%date1%' AND
MYDATE < '%date2%' )"

its the WHERE clause you need look
change MYDATE for the appropriate field from your database table

if your dates are in Ranges A1 abd B1 then the next line should be

sSQL = REPLACE(sSQL,"%date1%",Range("A1").Value)
sSQL = REPLACE(sSQL,"%date2%",Range("B1").Value)



"Jason" wrote in message
...
Dear all,

Could I create two cell for input the date range and update pivot table
(data from sql server) according the date range?

Thanks,
Jason