I would like to add that you should also include the following code to the end of Ray's code.
If you don't, you will discover some strange behavior with the record counter, record navigation, and may even cause you to create duplicate records by mistake. Adding the following code will get the counter and result set back in sync.
FormResultSetCurrentPosition(@Layout, @FormResultSetTotal(@Layout))
FormResultSetCurrentPosition(@Layout, 1)
I know that it seems silly to have two FormResultSetCurrentPosition commands in a row, but that's what it takes get things in sync.
Here are the various results that I found:
// Works partially...
// Does NOT work well with navigation buttons that change their visibility based on result set position
ResultSetCurrentPosition(@ResultSetTotal())
ResultSetCurrentPosition(1)
// Does NOT work by itself if there is just one record found
FormResultSetCurrentPosition(@Layout, @FormResultSetTotal(@Layout))
// This works in all cases - shows first record
FormResultSetCurrentPosition(@Layout, @FormResultSetTotal(@Layout))
FormResultSetCurrentPosition(@Layout, 1)
// This works in all cases - shows first record
FormResultSetCurrentPosition(@Layout, 1)
FormResultSetCurrentPosition(@Layout, 1)
// This works in all cases - shows last record
FormResultSetCurrentPosition(@Layout, @FormResultSetTotal(@Layout))
FormResultSetCurrentPosition(@Layout, @FormResultSetTotal(@Layout))