You will learn more about record scoping in Record scope, but it is helpful to cover all the syntax forms that can affect it before discussing the meaning of record scope in different situations. For now, you can scope or associate records in one or more tables with a DO block by using the FOR phrase:

DO FOR record[, record] . . .

Each record names a record you want to work with in the block and scopes it to the block. References within that block to fields the record contains are automatically associated with that record.

You have already seen an example of frame scoping in the code in the enable_UI procedure of h-CustOrderWin2.w and in the button triggers you created based on that code:

DISPLAY Customer.CustNum Customer.Name Customer.Address Customer.City 
  Customer.State 
  WITH FRAME CustQuery IN WINDOW CustWin.

You can use the phrase WITH FRAME frame-name and, optionally, IN WINDOW window-name to identify which frame you are talking about when you display fields or take other actions on objects in frames. If you wish, you can scope all the statements in a DO block with a frame by appending the WITH FRAME phrase to the DO statement itself.

For example, here is the BtnNext trigger block again with the frame qualifier moved to the DO statement:

DO:
  GET NEXT CustQuery.
  IF AVAILABLE Customer THEN 
  DO WITH FRAME CustQuery:
    DISPLAY Customer.CustNum Customer.Name Customer.Address Customer.City 
      Customer.State.
    {&OPEN-BROWSERS-IN-QUERY-CustQuery}
  END.
END.

Whether you name the frame in individual statements or in the block header, this makes sure that the AVM understands that you want the fields displayed in the frame where you defined them. If you do not do this, then depending on the context, the AVM might display the fields in a different frame.

There are other phrases you can use to qualify a DO block, but they mostly deal with transactions and error handling, which is described in Manage Transactions.