0
votes

I've seen a dozen or so different descriptions of how to do this, but I can't get the syntax right. I have a main form called "Master Lists". It has a navigation subform called "NavigationSubform". One of the navigation tabs opens a form called "Contract List".

I'm trying to use DoCmd.BrowseTo to open the Contract List on the subform.

My code is as follows:

DoCmd.BrowseTo acBrowseToForm, "[Contract List]", "[Master Lists].NavigationSubform"

But I get the error "The macro action BrowseTo requires a valid Path argument. A valid Path argument is of the form: MainForm1.Subform1>Form1.Subform1"

I've got the correct main form and subform, and the Contract List doesn't have any additional subforms, so I think I don't need the part after the ">". (Right?) Anyone have any ideas?

Thanks!

1
Remove the brackets - random_answer_guy

1 Answers

0
votes

This is strange, but apparently you need to drop the square brackets. Usually you need them, but in this case it causes issues with the path.

I finally answered my own question with the correct parameters in the DoCmd.BrowseTo command as follows:

DoCmd.BrowseTo ObjectType:=acBrowseToForm, _
ObjectName:="frmBatesFiles", _
PathToSubformControl:="Navigation Form.NavigationSubform", _
DataMode:=acFormEdit

The difficulty I was having was with the PathToSubformControl parameter. I had put square brackets around the form names containing spaces. When I removed the brackets it worked fine. I'm still open to other ways.

Note the path is "Navigation Form.NavigationSubform." Try deleting the brackets and see if it still throws an error. Quote and code found here