Common pitfalls with QAB and how to avoid them

Here are some hints on successful QAB programming from Margaret Dougherty,the top QAB programmer at Itim Technology Solutions.

Problem: I have a map with display fields and an OK button but I don't see the output.

Cause: The program does not pause for the user to click OK (or press Enter), consequently the map clears before you have seen it.

Solution: Make your procedure Interactive and put an input field in your map. This could be one of the display fields or it could be a new (invisible) field. In field processing set Input to Yes for this field but insert an i/o condition of No. If you used a display field remember you must display always. Insert another step in which you set JUMP = No. Check the field numbers and the rows and columns setting.

Problem: A formula is evaluated before it should be

Cause: You have initialised a variable at the start of a database procedure and have assigned a formula that you want to apply after doing some input. You need to suppress processing of this variable during the pre-evaluation stage of the procedure.

Solution: Include ‘$’ somewhere in your formula, but in a way that does not change its value. For example, ‘found’ could become ‘found and ($ = $)’, and ‘A * 100’ could become ‘if ($ = $) then A * 100 else 0’. The presence of ‘$’ in the formula ensures that it is evaluated only when the field is reached in the normal field processing.

Problem: I am using Window or Multiple choice access and don't see any records, but I have checked there are records in the table being accessed.

Cause: You have probably got 0, 0 in the rows and columns setting (in Map Properties for the choice map). Otherwise you need to check the condition to access and the condition on record for all the tables in your procedure.

Tip: Enhancing readability of Multi-part entry conditions

Problem: Only the first part is visible when you cursor through the program. This often makes the program hard to understand.

Solution: Insert a comment {More} in the formula to alert the reader to the existence of further conditions.