Actions Assignable to Buttons in DataWindow Objects

You can assign predefined actions to a Button control, or you can define an event script.

The table shows the actions you can assign to a button in a DataWindow object. Each action is associated with a numeric value (the Action DataWindow object property) and a return code (the actionreturncode event argument).

Use this code in the ButtonClicked event to display the value returned by the action:
MessageBox("Action return code", actionreturncode)
Action Effect Value Return
NoAction (default) Allows the developer to program the ButtonClicked event with no intervening action occurring. 0 The return code from the user's coded event script.
RetrieveYield Retrieves rows from the database. Before retrieval occurs, the option to yield turns on; this allows the Cancel action to take effect during a long retrieve. 1 Number of rows retrieved.

-1 if retrieve fails.

Retrieve Retrieves rows from the database. The option to yield is not automatically turned on. 2 Number of rows retrieved.

-1 if retrieve fails.

Cancel Cancels a retrieval that has been started with the option to yield. 3 0
PageNext Scrolls to the next page. 4 The row displayed at the top of the DataWindow control when the scrolling is complete or attempts to go past the first row.

-1 if an error occurs.

PagePrior Scrolls to the prior page. 5 The row that appears at the top of the DataWindow control when the scrolling is complete or attempts to go past the first row.

-1 if an error occurs.

PageFirst Scrolls to the first page. 6 1 if successful.

-1 if an error occurs.

PageLast Scrolls to the last page. 7 The row displayed at the top of the DataWindow control when the scrolling is complete or attempts to go past the first row.

-1 if an error occurs.

Sort Displays Sort dialog box and sorts as specified. 8 1 if successful.

-1 if an error occurs.

Filter Displays Filter dialog box and filters as specified. 9 Number of rows filtered.

Number < 0 if an error occurs.

DeleteRow If button is in detail band, deletes row associated with button; otherwise, deletes the current row 10 1 if successful.

-1 if an error occurs

AppendRow Inserts row at the end. 11 Row number of newly inserted row.
InsertRow If button is in detail band, inserts row using row number associated with the button; otherwise, inserts row using the current row. 12 Row number of newly inserted row.
Update Saves changes to the database. If the update is successful, a Commit will be issued; if the update fails, a Rollback will be issued. 13 1 if successful.

-1 if an error occurs

SaveRowAs Displays Save As dialog box and saves rows in the format specified. 14 Number of rows filtered.

Number < 0 if an error occurs.

Print Prints one copy of the DataWindow object. 15 0
Preview Toggles between preview and print preview 16 0
PreviewWithRulers Toggles between rulers on and off. 17 0
QueryMode Toggles between query mode on and off. 18 0
QuerySort Allows user to specify sorting criteria (forces query mode on). 19 0
QueryClear Removes the WHERE clause from a query (if one was defined). 20 0