Appling a 'go forward x amount of frames' action to a button can it b done?

i’ve made a game with 2 view so i need to be able to switch between them during it. Instead of making a goto frame 7 on the button on one frame for example and then a goto frame 8 on button on the next frame is there a way i could just put go forward 40 frames for example and apply that to the button on each frame, so on frame 1 the button would take u to frame 41 and on frame 3 it would take u to frame 43.

otherwise i’d have to keep changing the number for each frame

furthermore, is there a way i could make it go back say 40 frames to switch the view back?

can anyone help?