Go to a register using a macro

Sup, simple question I think, is there a macro function that can make the user go to an specific register by pushing a button?

Something like:

goto register

And then it navigates to the record number 5. I appreciate any help.

Not simple at all - I think.

Let’s assume you refer to a record number as register, but you don’t say, if you use a spreadsheet, a csv or text-table, dBase, an embedded database like HSQLDB, a local file database like Sqlite, a Server-Database like Postgres or MariaDB. Bigger databases even have multiple options to store data. Conclusion: You don’t “go” to a special record like using a file-seek, when you use databases. You just ask for the contents like

SELECT * FROM table WHERE id=5

With a macro you can also iterate over a result-set, but usually I recommend not to use to much assumptions on where the data comes from…

See the macro code (Sub MoveToRecord_5) for the Move to #5 button of the Biblio_Form_Dispatch.odt document from the @Villeroy example here.
How did @Villeroy guess your number (5) 4 years ago? :smile:

Is there a way to get the number of the current register, go back, and then return to the old current register? Like, im in the register 5, I catch this number using a function, put it inside of a variable, and then change @Villeroy macro to navigate to the number on the variable?

It seems to me that it is better to use the generally accepted term row number instead of the term register.
You can get the row number using the function getRow.
The FormOperations object has the Cursor property, which returns a Rowset.

This sounds like a massive confusion between row numbers vs. key numbers. Just add a subform which always shows the record(s) related to the current record side by side instead of jumping around.