View Full Version : Passing variables across macros


Peter Whitfield
10-26-2001, 09:11 AM
Apologies, if this is old hat however Im currently teaching myself Access 97 after years of DataEase.

I have 2 macros that run a) a spreadsheet export based on a date selected and then b) a printed report on the same date.

However, I cant seem to find a way to ask for the date at the start of the first macro and pass it to the second, therefore I am having to ask the same question twice.

In DataEase it would have been set as a global variable and passed over.

Peter

jwindon
10-27-2001, 12:19 PM
Is the selected date part of a query? If so, you can create a form (frmAsk4Date), unbound, and put an unbound control (or 2 for parameters) on it.

Write your query as

tblSpreadsheetData
field: DateField
criteria: =Forms!frmAsk4Date![ControlName]

Put a command button on your unbound form to execute the query, run your export and run your report.

Your report can be based off the same query.

Peter Whitfield
10-27-2001, 01:03 PM
Cheers mate, your a genius!