Form Navigation

keith701a

Registered User.
Local time
Yesterday, 21:26
Joined
Aug 9, 2016
Messages
38
I request help in creating a macro that:
  1. Close a form opened as a dialog window.
  2. Open a subform/control in a navigation form. The navigation form is open behind the dialog window.
Objects are named:
  • NS_Request_Info (dialog window).
  • New_Request_All is the subform/control I want to open after close NS_Request_Info
  • The navigation form and subform control kept their default name (Navigation Form and Navigation Subform).
Assistance is greatly appreciated! Thank you!
 
If you are closing the NS_Request_Info form from that form then this might work.

Code:
DoCmd.Close
DoCmd.BrowseTo acBrowseToForm, "New_Request_All", "Navigation Form.NavigationSubform"

Here's a video that might be helpful.
 
I added your code to the "on click" event of a button. I received this error:
Run-time error '2585': This action can't be carried out while processing a form or report event.
 
On which form is the button that runs the code?

Could you upload you database. It will make the process of finding the problem a lot faster.
 
I added the button to the search form that opens as a dialog. I read that dialog windows can cause VBA to not run, so I now have it opening as a regular window. Same issue.

I will need to upload it with the tables removed. They contain confidential information. I also had to remove reports to meet the attachment limit. Thank you for your help!
 

Attachments

I found the code in the form Current event like:

Code:
Private Sub Form_Current()
DoCmd.Close
DoCmd.BrowseTo acBrowseToForm, "New_Request_All", "Navigation Form.NavigationSubform"
End Sub

I thought you said you put it in the click event of a button.

I've attached the database in which I was testing the code I posted. To see how this works open the Navigation Form and then the NS_Request_Info form. When you click on the close button of the NS_Request_Info form it will go to the New_Request_All form on the Navigation Form. I believe for this to work you need to design it so that you can close the NS_Request_Info form before the BrowseTo. You may have to pass information throught TempVars or OpenArgs.
 

Attachments

I found the code in the form Current event like:

Code:
Private Sub Form_Current()
DoCmd.Close
DoCmd.BrowseTo acBrowseToForm, "New_Request_All", "Navigation Form.NavigationSubform"
End Sub

I thought you said you put it in the click event of a button.

I've attached the database in which I was testing the code I posted. To see how this works open the Navigation Form and then the NS_Request_Info form. When you click on the close button of the NS_Request_Info form it will go to the New_Request_All form on the Navigation Form. I believe for this to work you need to design it so that you can close the NS_Request_Info form before the BrowseTo. You may have to pass information throught TempVars or OpenArgs.

I got it working. Thank you for your help.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom