Tip of the Month (September 2006)
Using a Lookup Control in a Macro
In the midst of a macro, you may want to use a lookup control to look up a value in another table. But macros can only contain buttons and a lookup control is not a button. Here's how to incorporate a lookup into your macro.
Let's assume that there is a support table called PRICES with two columns (PART_NUMBER and PRICE) and that PART_NUMBER is indexed.
Let's also assume that your macro has two buttons in it:
First, somewhere outside the visible part of your form, create a lookup control that will look in the PRICES table and find the record whose PART_NUMBER equals @var(10). This lookup control should save the value found in @var(20).
Then, modify your macro by adding one button to it:
Please note that you do not put the lookup control into the middle of the macro. You put the OPTION | RECALC button into the middle of the macro. The lookup control is not a step in the macro.
When the macro runs, the new OPTION | RECALC button will cause the lookup control to fire and put the value found into @var(20).