could someone please help me with the following code, as always, its probably something really simple.
Ive been looking on the net to try and find a solution, but no luck so far.
my code is :
Range("D1").Select
With Selection.QueryTable
.Connection = "ODBC;DSN=GENERAL LEDGER;"
.CommandText = Array( _
"SELECT FLP003.ACCN03, FLP008.LINDES, FLP008.PSTAMT, FLP008.PSTPER, FLP008.DOCREF, FLP008.TT " _
& "FROM S44K6624.OSLGLF3.FLP003 FLP003, S44K6624.OSLGLF3.FLP008 FLP008 " _
& "WHERE FLP003.CONO = FLP008.CONO AND FLP008.ACCN08 = FLP003.ACCN03 AND ((FLP008.PSTPER=10608) AND (FLP008.CONO='IL') AND (FLP003.LVCD01='05' And FLP003.LVCD01<>'000') AND (FLP003.LVCD02='310')) ")
.Refresh BackgroundQuery:=False
Call Filter
End With
I think the problem is coming from the commandtext line, but again, im not sure.
What the code is supposed to do is dial into our as400 and update a spreadsheet with all the relevant info.
Hope Ive given enough information, and that someone can help.
Regards
Neil
Ive been looking on the net to try and find a solution, but no luck so far.
my code is :
Range("D1").Select
With Selection.QueryTable
.Connection = "ODBC;DSN=GENERAL LEDGER;"
.CommandText = Array( _
"SELECT FLP003.ACCN03, FLP008.LINDES, FLP008.PSTAMT, FLP008.PSTPER, FLP008.DOCREF, FLP008.TT " _
& "FROM S44K6624.OSLGLF3.FLP003 FLP003, S44K6624.OSLGLF3.FLP008 FLP008 " _
& "WHERE FLP003.CONO = FLP008.CONO AND FLP008.ACCN08 = FLP003.ACCN03 AND ((FLP008.PSTPER=10608) AND (FLP008.CONO='IL') AND (FLP003.LVCD01='05' And FLP003.LVCD01<>'000') AND (FLP003.LVCD02='310')) ")
.Refresh BackgroundQuery:=False
Call Filter
End With
I think the problem is coming from the commandtext line, but again, im not sure.
What the code is supposed to do is dial into our as400 and update a spreadsheet with all the relevant info.
Hope Ive given enough information, and that someone can help.
Regards
Neil