Is it possible that the button isn't entirely in the body part, slightly overlapping into header or footer. What's the script attached to the button?
No such function is needed, but you need to check the design of your layouts and underlying data model. If Layout A is a list view and has "Table A" specified in the Show Records From drop down found in layout setup. And "Layout A|Form" is a form view layout that also specifies "Table A" in Show Records From, all your button would need to do is use Go to Layout to change layouts, provided that your button is placed in the body layout part and ato do this all in the same window. The mouse click on the button makes it the current record and since all layouts that specify the same table occurrence name in Show Records From share the same found set and current record (provided that you are in the same window), that record would then be the record you see in the Table A|Form layout.
Since this is not happening, some aspect of your design is interfering. Note first, that I have described a list view layout as that is what you describe. If, on the other hand, you are using a portal to list these records, then you can't use a button with go to layout. Instead, you would use a button with Go To Related Records.
And with either "list"--a list view layout or a portal, script triggers can be tripped by your button's change in layouts and this can interfere with the results you want to achieve.
And in other cases, you set up a script performed by your button to copy your current record's primary key into a variable, that your script then uses as search criteria in performing a find on the layout that it changes to. This may be necessary if your Tutorial: What are Table Occurrences? names don't match in Layout Setup or you are moving the focus from one window to another.