Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm new to this so please be easy on me. I have a macro the returns
data from a query. I want to change the criteria of this query by entering new dates into a text box. I have not yet added the text boxes but I have changed the data in the code. (Remember baby steps) When I run the macro I get a error. Bad character found in date string. Please help me fix this. Dim EDate As Variant, EndDate As String EDate = "9-sep-2005 07:00:00" EndDate = EDate Sheets("sheet3").Select Range("D6").Select ActiveSheet.PivotTableWizard SourceType:=xlExternal, SourceData:=Array( _ "SELECT ss_hist_base.mach_name, ss_hist_base.tool, ss_hist_base.shift_id, Sum(ss_hist_base.total_down_time)" & Chr(13) & "" & Chr(10) & "FROM plantstar.ss_hist_base ss_hist_base" & Chr(13) & "" & Chr(10) & "WHERE (ss_hist_base.start_time='29-aug-2005 07:00" _ , _ ":00' And ss_hist_base.start_time<'EndDate &"" ' )" & Chr(13) & "" & Chr(10) & "GROUP BY ss_hist_base.mach_name, ss_hist_base.tool, ss_hist_base.shift_id" _ ), Connection:= _ "ODBC;DSN=OPENINGRES;SERVER=PLANTSTAR;DATABASE=foc us2000;SERVERTYPE=INGRES" ActiveSheet.PivotTables("PivotTable1").SmallGrid = False ActiveSheet.PivotTables("PivotTable1").AddFields RowFields:="mach_name", _ ColumnFields:="tool" Sheets("report").Select End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
split post code (zip code) out of cell that includes full address | Excel Discussion (Misc queries) | |||
Code to conditional format all black after date specified in code? | Excel Discussion (Misc queries) | |||
Drop Down/List w/Code and Definition, only code entered when selec | Excel Worksheet Functions | |||
run code on opening workbook and apply code to certain sheets | Excel Programming | |||
stubborn Excel crash when editing code with code, one solution | Excel Programming |