I'm trying to import data from a database programatically and while I'm close I'm still failing miserably.
I'm able to get the data in, but it brings extra crap with it that I don't want/need.
Here's the code:
The results of the query come in with 3 cells, one of which has the data I want:
All I want i the 119.5 at the bottom. Is there a way only retrieve the data I'm asking for, instead of the extra stuff?
Here's the contents of the .iqy file (sensitive data removed):
Thanks!
I'm able to get the data in, but it brings extra crap with it that I don't want/need.
Here's the code:
Code:
Sub Get_Standard_Cost()
IQYFile = "C:\My Documents\My Queries\Std Cost.iqy"
With ActiveSheet.QueryTables.Add(Connection:= _
"FINDER;" & IQYFile, Destination:=Range("B1"))
.BackgroundQuery = True
.TablesOnlyFromHTML = True
.Refresh BackgroundQuery:=False
.SaveData = True
End With
End Sub
The results of the query come in with 3 cells, one of which has the data I want:
Results For: dbo.Purchasing Data
STD COST
119.5
All I want i the 119.5 at the bottom. Is there a way only retrieve the data I'm asking for, instead of the extra stuff?
Here's the contents of the .iqy file (sensitive data removed):
WEB
1
https://company.com/scripts/analyzer.exe/dbo.Purchasing%20Data.dbf?St=6&db=Purchasing&tbl=dbo.Purchasing+Data&nq=&nL=1&CT=0&sd=63&dF=-1&o=-1&o=-1&o=-1&fPP=2&rR=25&qF6=contains+["value1","Please enter a part number:"]&qF19=&qF63=
Selection=3
Formatting=None
PreFormattedTextToColumns=False
ConsecutiveDelimitersAsOne=True
SingleBlockTextImport=False
DisableDateRecognition=False
DisableRedirections=False
Thanks!