Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
excel dates in sql procedures
I am still getting sql syntax error.
Here is my procedu Sub ABC() Dim qt As QueryTable Dim a As String Dim b As String Sheets("abc").Select a = Range("a1").Text b = Range("a2").Text sqlstring = "exec emputilization " & a & "," & b "ODBC;DSN=empdata;UID=;PWD=;Database=empdata" Sheets("Temp").Select With ActiveSheet.QueryTables.Add( _ Connection:=connstring, _ Destination:=Range("A1"), Sql:=sqlstring) ..Refresh End With End Sub Sheet "abc" : A1 is the startdate 1/1/2007 and A2 is the enddate 1/31/2007 Any help is appreciated. Thanks, ragup |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
excel dates in sql procedures
Just a suggsetion. Try
sqlstring = "exec emputilization " & _ Format(Range("A1").Value, "\#dd mmmm yyyy\#") & "," & _ Format(Range("B1").Value, "\#dd mmmm yyyy\#") -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "ragup001" wrote in message ... I am still getting sql syntax error. Here is my procedu Sub ABC() Dim qt As QueryTable Dim a As String Dim b As String Sheets("abc").Select a = Range("a1").Text b = Range("a2").Text sqlstring = "exec emputilization " & a & "," & b "ODBC;DSN=empdata;UID=;PWD=;Database=empdata" Sheets("Temp").Select With ActiveSheet.QueryTables.Add( _ Connection:=connstring, _ Destination:=Range("A1"), Sql:=sqlstring) .Refresh End With End Sub Sheet "abc" : A1 is the startdate 1/1/2007 and A2 is the enddate 1/31/2007 Any help is appreciated. Thanks, ragup |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
excel dates in sql procedures
sqlstring = "exec emputilization '" & a & "','" & b & "'"
-- Tim Zych SF, CA "ragup001" wrote in message ... I am still getting sql syntax error. Here is my procedu Sub ABC() Dim qt As QueryTable Dim a As String Dim b As String Sheets("abc").Select a = Range("a1").Text b = Range("a2").Text sqlstring = "exec emputilization " & a & "," & b "ODBC;DSN=empdata;UID=;PWD=;Database=empdata" Sheets("Temp").Select With ActiveSheet.QueryTables.Add( _ Connection:=connstring, _ Destination:=Range("A1"), Sql:=sqlstring) .Refresh End With End Sub Sheet "abc" : A1 is the startdate 1/1/2007 and A2 is the enddate 1/31/2007 Any help is appreciated. Thanks, ragup |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can I import SQL Stored Procedures into Excel? | Excel Discussion (Misc queries) | |||
Excel VBA procedures running at erratic speeds | Excel Programming | |||
Running sql stored procedures from Excel | Excel Discussion (Misc queries) | |||
Can Access stored procedures be executed from within Excel | Excel Programming | |||
Using Excel to handle Com callback procedures | Excel Programming |