Link to home
Start Free TrialLog in
Avatar of TechMommy
TechMommyFlag for United States of America

asked on

Access 2010 Navigation Control

I am using the Navigation Control in a medium-sized application with a fair amount of complexity. I am having trouble with the BrowseTo method. It returns no data when I add a WhereClause. My code looks like this:

 
 Dim lngEntity As Long
    lngEntity = [Forms]![SiteNavigation].[NavigationSubform].[Form].[apd__entity__entity_id]
    DoCmd.BrowseTo acBrowseToForm, _
        ObjectName:="SnapshotRelationshipQuery", _
        PathtoSubformControl:="SiteNavigation.NavigationSubform>Snapshotseries Navigation.Navigationsubform", _
        WhereCondition:="[apd__entity__entity_id] = " & lngEntity

Open in new window


I have validated that lngEntity contains the correct value.

Any suggestions would be appreciated!
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

<I am using the Navigation Control in a medium-sized application with a fair amount of complexity. >

1. Is a Navigation control the only way to do what you need here?

You can certaily create your own form to open any object, ...in any mode:
DoCmd.OpenForm "YourForm", , , "[apd__entity__entity_id] = " & lngEntity


2. Try using the Full sysntax, this way you don't have to pray that you did not mis-spell anything, ...and you can use intellesense:
Docmd.BrowseTo acBrowseToForm, "frmCustomers", "NavigationForm.NavigationSubform","CustID=" & lngCustID


3. Is the ">" in this line of code corrcet?
"SiteNavigation.NavigationSubform>Snapshotseries Navigation.Navigationsubform"

4. Before you get fancy and use variables, does it work if you hardcode an actual, valid  value:
    DoCmd.BrowseTo acBrowseToForm, _
        ObjectName:="SnapshotRelationshipQuery", _
        PathtoSubformControl:="SiteNavigation.NavigationSubform>Snapshotseries Navigation.Navigationsubform", _
        WhereCondition:="[apd__entity__entity_id] =" & 17
...or even like this:
        WhereCondition:="[apd__entity__entity_id] =17 "


JeffCoachman
Avatar of TechMommy

ASKER

Hi Jeff,

1. The client likes the look and feel of the Navigation control and wants me to use it.

2. No sure what you mean here. What about my method is not the full syntax?

3. Yes, the ">" is correct. It is required as far as I know.

4. I first tried it without variables and got the identical results.

Alison
Avatar of puppydogbuddy
puppydogbuddy

glancing at your syntax for the PathToSubformControl, there is a space between Snapshotseries and Navigation, which I believe requires the use of brackets as shown below.

PathtoSubformControl:="SiteNavigation.NavigationSubform>[Snapshotseries Navigation].Navigationsubform", _


If that is not the problem, the following is a good reference source with examples that may help you find the problem.

http://blogs.office.com/b/microsoft-access/archive/2010/02/23/access-2010-browseto-docmd-and-macro-action.aspx
No, actually the brackets return "invalid syntax". I know that the PathToSubformControl is correct because if I remove the WhereClause, I get all rows.

Yes, I had discovered that article. Although somewhat helpful, it doesn't go into the level of depth that I need.

Thanks for trying,

Alison
If you put a breakpoint on line 3, what is the value of lngEntity at that point?
It is the correct value, 1970.

If I hardcode that value, rather than using the variable, I get the same results.
And I assume you have the data type of apd__entity__entity_id as a Number and not Text, right?

All I could say is if you could upload a stripped down version of your database with just the necessary objects and enough (non-privacy) data for us to see the problem and dig into it further, it would help.
ASKER CERTIFIED SOLUTION
Avatar of TechMommy
TechMommy
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Although some of the comments were interesting, I ultimately solved this problem through trial and error on my own.