Okay - I'm not very good at explaining my problems but I'll do the best I can.
I have 20 small tables with one field containing approximately twenty office names.
I need Access VBA code to decalre a variable, then something like, for i from 1 to endOfTable, look at tblName, assign the first office name to the variable then run the SQL code below using the variable.
Then I will dump the WST and the WSTDV and the variable into a small table that I will place on the last page of a report and look for the next office in the tblName and do it again until all of the offices have been run.
Whew! Hope I got that right.
Please remember - I know nothing about VBA!
Thanks Much . . .
Rick ~ Access Newbie
I have 20 small tables with one field containing approximately twenty office names.
I need Access VBA code to decalre a variable, then something like, for i from 1 to endOfTable, look at tblName, assign the first office name to the variable then run the SQL code below using the variable.
Then I will dump the WST and the WSTDV and the variable into a small table that I will place on the last page of a report and look for the next office in the tblName and do it again until all of the offices have been run.
Whew! Hope I got that right.
Please remember - I know nothing about VBA!
Code:
SELECT Sum([SALESPRICE]) AS [WSTDV], Count(OCMonthlyData.SalesPrice) AS [WSTCount]
FROM OCMonthlyData
WHERE (((OCMonthlyData.OFFICELIST_OFFICENAME) Like "variable") AND ((OCMonthlyData.OFFICESELL_OFFICENAME) Not Like "variable"));
Thanks Much . . .
Rick ~ Access Newbie