?
Solved

Access 2010 Navigation Control

Posted on 2012-09-10
9
Medium Priority
?
1,741 Views
Last Modified: 2014-04-22
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!
0
Comment
Question by:TechMommy
9 Comments
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 38385729
<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
0
 
LVL 11

Author Comment

by:TechMommy
ID: 38386622
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
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 38388201
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
0
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 
LVL 11

Author Comment

by:TechMommy
ID: 38389433
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
0
 
LVL 29

Expert Comment

by:IrogSinta
ID: 38389460
If you put a breakpoint on line 3, what is the value of lngEntity at that point?
0
 
LVL 11

Author Comment

by:TechMommy
ID: 38389467
It is the correct value, 1970.

If I hardcode that value, rather than using the variable, I get the same results.
0
 
LVL 29

Expert Comment

by:IrogSinta
ID: 38389480
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.
0
 
LVL 11

Accepted Solution

by:
TechMommy earned 0 total points
ID: 38393045
I figured it out. The code I ultimately used was this:

 
  Dim lngEntity As Long
    lngEntity = [Forms]![SiteNavigation].[NavigationSubform].[Form].[apd__entity__entity_id]
    DoCmd.BrowseTo acBrowseToForm, _
        objectname:="SnapshotRelationshipQuery", _
        PathtoSubformControl:="SiteNavigation.NavigationSubform", _
        wherecondition:="[Entity1] = " & lngEntity & " OR [Entity2] = " & lngEntity

Open in new window


It was a matter of aliasing the fields in the underlying query and basing the controls on the correct aliases. Also, whereas the PathtoSubformControl was correct for some of my forms, it was not for this form.

Ultimately it was a matter of getting the correct combination of the ObjectName, PathtoSubformControl, and WhereCondition.

Thank you all for your help.
0
 
LVL 11

Author Closing Comment

by:TechMommy
ID: 40014331
Although some of the comments were interesting, I ultimately solved this problem through trial and error on my own.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question