Help opening form to a specific page

kevinh2320

Board Regular
Joined
May 13, 2016
Messages
61
In my Access DB I'm trying to open a form called "f-home" to page number 7 with the following code but, it doesn't seem to like the hypen in the form name. I've tried to bracket the form name and put into quotes but can't find the right method.

Private Sub import_rpt_data_Click()

DoCmd.OpenForm "f-home"
Forms!f-home.GoToPage 7

End Sub

Any suggestions?
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Usually, you do not refer to Forms in Access by "page" numbers, but rather by "record" numbers.
What exactly are you trying to do?
How is your form structured?
 
Upvote 0
On my main form called f-home I've used the control "tab control" and on that control I have multiple pages. On page 7 "Work Area" I have a button that runs some code but, when that code is finished running the form re-opens back to the first page "Letters & Envelopes". When that code finishes running I want the user to be returned to the page they were on "Work Area".

1585676734073.png
 
Upvote 0
Ah yes, I had forgotten about Tab Controls. It has been many years since I used those.
You have to open the Form, then Set the Focus to that particular page name.
See this example here: Open to specific tab page
 
Upvote 0

Forum statistics

Threads
1,214,924
Messages
6,122,294
Members
449,077
Latest member
Rkmenon

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top