mobile databases, mobile forms, and mobile synchronization … where you need to work
Providing Pocket Access, Mobile Database, Windows CE Database, and Windows CE Development Solutions

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:

  1. Button 1: Assigns the part number to @var(10)
  2. Button 2: Some button that expects the price of the part to be in @var(20)

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:

  1. Original Button 1: Assigns the part number to @var(10)
  2. New Button: OPTION | RECALC
  3. Original Button 2: Some button that expects the price of the part to be in @var(20)

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).