So I know almost nothing about SQL. I've been reverse engeneering a odc file that pulls a query from a database.
I have modified it to be able to pull specific columns out of the table. What I would like to do is use a range as my
The bolded part is where I would like to replace those two numbers with a range of numbers from an excel file.
Could be thousands of rows to look up. I know I could probably concantonate a string, but I would have to think there is an easier way to do this.
Just need to convert the range into a variable I can call from this code. Just not sure how exactly to do this.
Any help would be greatly appreciated. I am sure it's probably simple to those who are familiar with this.
I have modified it to be able to pull specific columns out of the table. What I would like to do is use a range as my
Code:
PKMSID = InputBox("PKMS Login")
With ActiveSheet.ListObjects.Add(SourceType:=0, Source:=Array(Array( _
"ODBC;DRIVER={iSeries Access ODBC Driver};UID=" & PKMSID & ";SIGNON=1;PKG=QGPL/DEFAULT(IBM),2,0,1,0,512;LANGUAGEID=ENU;DFTPKGLIB=QGPL;DBQ=Q" _
), Array("GPL WM0272PRDD;SYSTEM=PKMS0272.US.CORP;")), Destination:= _
Range("$A$1")).QueryTable
.CommandText = Array( _
"SELECT PHPICK00.PHPKTN, PDPICK00.PDSTYL, PDPICK00.PDOPQT, PDPICK00.PDSTYD, PHPICK00.PHPSTF" & Chr(13) & "" & Chr(10) & "FROM CAPM01.WM0272PRDD." _
, _
"PDPICK00 PDPICK00, CAPM01.WM0272PRDD.PHPICK00 PHPICK00" & Chr(13) & "" & Chr(10) & "WHERE PDPICK00.PDPCTL = PHPICK00.PHPCTL AND ((PHPICK00.PHWH" _
, "SE='BNA') AND (PHPICK00.PHPSTF=<'90') [B]AND (PHPICK00.PHPKTN IN ('677722691', '693205564'[/B])))")
The bolded part is where I would like to replace those two numbers with a range of numbers from an excel file.
Could be thousands of rows to look up. I know I could probably concantonate a string, but I would have to think there is an easier way to do this.
Just need to convert the range into a variable I can call from this code. Just not sure how exactly to do this.
Any help would be greatly appreciated. I am sure it's probably simple to those who are familiar with this.