View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
ragup001 ragup001 is offline
external usenet poster
 
Posts: 3
Default 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