Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditional output in a macro

Status
Not open for further replies.

Lizard

Technical User
Mar 14, 2001
14
BE
Hello,

I'm trying to put in a macro an "OutputTo" function that outputs a query's result to Excel if a condition is met. The condition should be expressed like :"([Sum of sales for CZSALES]![SumOfsales]>=[Sum of sales for CZSALES yesterday]![SumOfsales])", where "[Sum of sales for CZSALES]" and "[Sum of sales for CZSALES yesterday]" are the queries to compare.

When I run the macro, it shows an error message "Microsoft Access can't find the name 'Sum of sales for CZSALES' you entered in the expression".

This message box suggests to specify if it comes from a form or a report but it doesn't accept if I write the condition like :"(Queries![Sum of sales for CZSALES]![SumOfsales]>=Queries![Sum of sales for CZSALES yesterday]![SumOfsales]).

Can anybody help ?

Thanks

Olivier
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top