ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Working with ODBC and filtering data (https://www.excelbanter.com/excel-programming/286050-working-odbc-filtering-data.html)

Jeff[_27_]

Working with ODBC and filtering data
 
I hava a pivot table that I would like to change the date
on with an imput box. The string reads:
ActiveSheet.PivotTableWizard SourceType:=xlExternal,
SourceData:=Array( _
"SELECT WORKORDER.LEADCRAFT, WORKORDER.REPORTDATE,
WORKORDER.WONUM, WORKORDER.STATUS, WORKORDER.PROBLEMCODE,
WORKORDER.GLACCOUNT, WORKORDER.WORKTYPE,
WORKORDER.SUPERVISOR, WORKORDER.WOPRIORITY" & Chr(13) & ""
& Chr(10) & "FROM MA", _
"XIMO.WORKORDER WORKORDER" & Chr(13) & "" & Chr
(10) & "WHERE (WORKORDER.WORKTYPE='PM') AND
(WORKORDER.SUPERVISOR In
('MAXPLN1','MAXPLN2','MAXPLN3','MAXPLN4')) AND
(WORKORDER.WOPRIORITY=6) AND (WORKORDER.STATUS In
('INPRG','WAPPR'", _
",'WMATL','WSCH')) AND (WORKORDER.REPORTDATE<
{ts '2002-12-23 00:00:00'})" & Chr(13) & "" & Chr(10)
& "ORDER BY WORKORDER.LEADCRAFT" _
),
Connection:="ODBC;DSN=TEM;DBQ=sandusky.world;UID=M AXOPR1;PW
D=maxopr1"
ActiveSheet.PivotTables("PivotTable1").SmallGrid =
False
ActiveSheet.PivotTables("PivotTable1").AddFields
RowFields:="LEADCRAFT", _
ColumnFields:="GLACCOUNT", PageFields:="SUPERVISOR"


I would like to be able to change the date {ts '2002-12-23
00:00:00'} by entering a date in on a work sheet or a
message box. Is there a way to do this?


All times are GMT +1. The time now is 04:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com