I'm clearly lacking some knowledge on excel queries.. I need to print out some custom labels with the ordered articles of each worker.
In my example, i have 2 tables:
[tabWorkers]
ID Name
1 John
2 Patrick
[tabOrders]
ID Article Amount
1 Shoe 2
1 T-Shirt 5
2 T-Shirt 3
I'm looping through tabWorker and for each working i would like to query my tabOrders table: SELECT * FROM tabOrders WHERE ID=1
Syntax example of what i want:
Dim row As Range
For Each row In [tabWorkers].Rows
myID = row.Columns(row.ListObject.ListColumns("ID").Index).Value
Write( row.Columns(row.ListObject.ListColumns("Name").Index).Value & " has ordered...<p>" )
For Each (Article, Amount) In "SELECT * FROM tabOrders WHERE ID ='" & myID & "'")
Write( Amount & " x " & Article & "<br>" )
Next
Next