AndrewMozley
Programmer
I have a grid which is used to accept a variable number of records. The recordsource is a cursor, tDetail; this has one empty record when the grid first receives focus.
After the user has entered data into one or more rows, if the records validate correctly they may be posted; the form moves onto the next transaction - clearing the grid by re-creating cursor tdetail.
This works fine. However, when the last cell in the last row loses focus, I would like to create a new record in tdetail if we are located on the last record of tdetail.
To do this, I APPEND a blank record to detail, go to the BOTTOM of tdetail, and (for good measure) try to move to the bottom row of the grid, with this code :
Code:
SELECT tDetail
APPEND BLANK
GO BOTTOM
.grdmain.column1.SetFocus()
KEYBOARD "{DNARROW}"
There is probably some redundant code here – (have tried several instructions to move focus to the new last row of the grid). However I am finding that focus is not set to the new (empty) last row, but still to the row which has just been completed.
If however I insert a breakpoint (using SET STEP ON or by using the F9 key), just before the above code, the form works fine : after RESUMEing the program the focus is indeed set to the last row.
How should I set focus to the first cell in the newly created last row?
Thanks. Andrew