W
warnett
hey everyone,
Im making a macro which opens several queries and sums a specific column
from each query, and adds these sums together. In addition to this, added to
the sums is the number of records which have not been marked as 'cancelled'
multiplied by 2.5. The total of this is displayed in a message box
The running of my macro is as follows:
OpenQuery {Money Taken SC}
OpenQuery {Money Taken T1}
OpenQuery {Money Taken T2}
OpenQuery {Money Taken T3}
OpenQuery {Money Taken T4}
OpenQuery {Money Taken T5}
MsgBox:
=Sum([Money Taken T1]![Cost1])+Sum([Money Taken T2]![Cost2])+Sum([Money
Taken T3]![Cost3])+Sum([Money Taken T4]![Cost4])+Sum([Money Taken
T5]![Cost5])+(Count([Money Taken SC]![Order ID])*2.5)
But alas, it doesnt work. I get the error message that i need to be specific
to an object if it is not the current one. Which i am. Im using the syntax
where the query name is then followed by the field name.
Someone mentioned to me that i may need to make a report for each, then sum
it from there. Surely this need not be done? Is there a way around this?
If you know of a way round, please reply!
Thanks for your time,
Jason
Im making a macro which opens several queries and sums a specific column
from each query, and adds these sums together. In addition to this, added to
the sums is the number of records which have not been marked as 'cancelled'
multiplied by 2.5. The total of this is displayed in a message box
The running of my macro is as follows:
OpenQuery {Money Taken SC}
OpenQuery {Money Taken T1}
OpenQuery {Money Taken T2}
OpenQuery {Money Taken T3}
OpenQuery {Money Taken T4}
OpenQuery {Money Taken T5}
MsgBox:
=Sum([Money Taken T1]![Cost1])+Sum([Money Taken T2]![Cost2])+Sum([Money
Taken T3]![Cost3])+Sum([Money Taken T4]![Cost4])+Sum([Money Taken
T5]![Cost5])+(Count([Money Taken SC]![Order ID])*2.5)
But alas, it doesnt work. I get the error message that i need to be specific
to an object if it is not the current one. Which i am. Im using the syntax
where the query name is then followed by the field name.
Someone mentioned to me that i may need to make a report for each, then sum
it from there. Surely this need not be done? Is there a way around this?
If you know of a way round, please reply!
Thanks for your time,
Jason