Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
sd sd is offline
external usenet poster
 
Posts: 9
Default some code help please

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
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
split post code (zip code) out of cell that includes full address Concord Excel Discussion (Misc queries) 4 October 15th 09 06:59 PM
Code to conditional format all black after date specified in code? wx4usa Excel Discussion (Misc queries) 3 December 26th 08 07:06 PM
Drop Down/List w/Code and Definition, only code entered when selec Spiritdancer Excel Worksheet Functions 2 November 2nd 07 03:57 AM
run code on opening workbook and apply code to certain sheets Jane Excel Programming 7 August 8th 05 09:15 AM
stubborn Excel crash when editing code with code, one solution Brian Murphy Excel Programming 0 February 20th 05 05:56 AM


All times are GMT +1. The time now is 07:24 PM.

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

About Us

"It's about Microsoft Excel"