Hello
I need some help with trying to update a query that I created in Excel. As the amount of data that I extract periodically each time is quite huge, therefore, I have to add a criteria in query to filter via Month (Period). This requires constantly going into the query table to change criteria data. Are there any ways of updating the criteria field by by referencing it against a cell in excel?
Below is a brief code that i created in vbe to try to change the criteria but instead of having the value in range("a1"
transposed to the criteria field, the text periodic is transposed to the criteria field instead.
I have deleted some of the commands so that it would not look too long. Have just included one of the line items for your reference.
It would be greatly appreciated if someone would be able to help out.
Thanks!
Cheers,
Lagoon1.
Sub Update
periodic = Range("A1"
With Selection.QueryTable
.Connection = .....................
.Sql = Array(......................
(FLP004.PSTPER= 10406) ' This is where the criteria field that needs to reference to the variable declared.
.Refresh False
End With
End Sub
I need some help with trying to update a query that I created in Excel. As the amount of data that I extract periodically each time is quite huge, therefore, I have to add a criteria in query to filter via Month (Period). This requires constantly going into the query table to change criteria data. Are there any ways of updating the criteria field by by referencing it against a cell in excel?
Below is a brief code that i created in vbe to try to change the criteria but instead of having the value in range("a1"
I have deleted some of the commands so that it would not look too long. Have just included one of the line items for your reference.
It would be greatly appreciated if someone would be able to help out.
Thanks!
Cheers,
Lagoon1.
Sub Update
periodic = Range("A1"
With Selection.QueryTable
.Connection = .....................
.Sql = Array(......................
(FLP004.PSTPER= 10406) ' This is where the criteria field that needs to reference to the variable declared.
.Refresh False
End With
End Sub