G
guy
How to select field names which contain a dot "."?
Error comes out when running the following codes, i guess it is caused by
the field name "ship.date"
Would you pls advise...
Thanks a lot!!
______________________________________________
Sub getFields()
Dim varConn2, varSql2 As String
Dim varQry2 As QueryTable
varConn2 = "ODBC;DefaultDir=c:\Test;driver={Microsoft Excel Driver
(*.xls)};DriverId=790;dbq=c:\Test\table1.xls"
varSql2 = "SELECT PRODUCT, [Unit Price] as UNIT_PRICE, ship.date, sum([Open
Qty]) as SUM_OPEN_QTY from [Raw$] group by Product, [Unit Price], ship.date"
Set varQry2 = Worksheets("test").QueryTables.Add(Connection:=varConn2,
Destination:=Worksheets("test").Range("a1"), Sql:=varSql2)
Worksheets("test").Range("A:IV").ClearContents
varQry2.BackgroundQuery = False
varQry2.Refresh
End Sub
Error comes out when running the following codes, i guess it is caused by
the field name "ship.date"
Would you pls advise...
Thanks a lot!!
______________________________________________
Sub getFields()
Dim varConn2, varSql2 As String
Dim varQry2 As QueryTable
varConn2 = "ODBC;DefaultDir=c:\Test;driver={Microsoft Excel Driver
(*.xls)};DriverId=790;dbq=c:\Test\table1.xls"
varSql2 = "SELECT PRODUCT, [Unit Price] as UNIT_PRICE, ship.date, sum([Open
Qty]) as SUM_OPEN_QTY from [Raw$] group by Product, [Unit Price], ship.date"
Set varQry2 = Worksheets("test").QueryTables.Add(Connection:=varConn2,
Destination:=Worksheets("test").Range("a1"), Sql:=varSql2)
Worksheets("test").Range("A:IV").ClearContents
varQry2.BackgroundQuery = False
varQry2.Refresh
End Sub