Access 2010: Browse To

Finally, I have figured out the limitations of using the “Browse To”.  Whether you are creating a macro or actually writing the code, the failure can be a result of two factors:

  • You did not reference the form path correctly.
  • You lost the value of the search field(s).

Keep in mind that this is only applicable to using the new Navigation controls.

Access 2010 Navigation

Let me begin by explaining my navigation.  I click the “Lookup” button and select a letter from the alphabet (hyperlinks with onclick code), which populates a combo box.  From the combo box, a selection is made, and a contact card is populated.

From the “Lookup” subform, I want to click the hyperlink and navigate to the “Edit” subform.

In order to this, you must follow a set of steps to keep the value that you use to search as well as to be able to open the subform.  Let’s begin with how my field is referenced on the “Lookup” form.

[Forms]![Navigation]![Search].[Form]![ContactID]

Navigation is the name of the form that holds the navigation tabs and their second level buttons.  Search is the actual area or subform under the buttons.  “Search” is not the target of the button.  It is the subform that holds the button’s target.  Try and keep this straight.  The target is set in the button’s property, i.e. Lookup or Edit.

If you were to click the button “Lookup” in Design View and go to the Data tab, you would see the Navigation Target Name is “ContactCard”.  If you looked at the same property for the button “Edit”, you would see the value as “ContactList”.  The target names are not relevant.  This was hard for me to overcome, and I learned by accident.

The part that you need for the Path to Subform Control is “Navigation.Search” in the macro.  (Why I used “Search” is only because I failed to rename it after I had built the app.  I suggest you name it “NavSub” to omit any confusion.)

Let’s address how to keep the value of the filed that you are searching or for which navigation is based.  In this instance, the value is coming from the field “ContactID“.

You will need to create a temporary variable to hold this value.  Once you browse from this form, you will lose the value.  In your macro, choose “SetTempVar” and give it a name.

To find the path to Lookup-ContactID, I opened the navigation form, clicked the tab, and clicked the button to view the “Lookup” form.  I left this open.  I returned to the macro group where I had begun the submacro group, “editlookup”.

I used the Expression Builder to find the field.  I clicked my way through to Loaded Forms, Navigation, and the name of the form that was the target for the “Lookup” button.  From the list of controls,  I found the field “ContactID“.

On double-click, Access puts [Forms]![Navigation]![Search].[Form]![ContactID] in the expression text box.  I clicked OK.  My temporary variable will now have a value.

You can see a clip of the full macro here ….

All that is left is to fill in the fields in the BrowseTo of your macro.  Click the graphic above to view in full screen.  I hope this helps.

I stumbled for quite some time until I realized that loosing focus, loosing values, and wrong paths were things that I took for granted or expected to be much more complicated than they actually were.

Advertisements

4 responses to “Access 2010: Browse To

  1. thedavidmaiden

    Thanks very much. This was by far the clearest tutorial on the net for getting this to work! Saved me losing my remaining hair… David

  2. Hey David, I just noodled out a problem with browse-to. If you try and use a combo box or any user selected search tool on the form that you had come to using browseto in which you selected a specific record for the “where” …. well, let’s just say that any other search selections are almost wonky based on the filter that the browseto will set on the form. A quick line though … Me.FilterOn = False

    I will post some more on some of these newer features soon!

  3. Brilliant post. After several hours trying to decypher MS’s ‘Help’ and other attempted explanations of how to use this function’s context I found this page and solved the problem in five minutes. Thanks

    • I believe that was the key reason for my own post. I have a dozen or so “notes” that need posted, but this one was certainly worth the effort. It took me days to noodle this one out!

      You are most welcome!

Share what you think or ask a question!

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s