TechMommy
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:
I have validated that lngEntity contains the correct value.
Any suggestions would be appreciated!
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
I have validated that lngEntity contains the correct value.
Any suggestions would be appreciated!
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
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
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:="Sit eNavigatio n.Navigati onSubform> [Snapshots eries Navigation].Navigationsubf orm", _
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
PathtoSubformControl:="Sit
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
ASKER
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
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?
ASKER
It is the correct value, 1970.
If I hardcode that value, rather than using the variable, I get the same results.
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.
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Although some of the comments were interesting, I ultimately solved this problem through trial and error on my own.
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.Navigation
3. Is the ">" in this line of code corrcet?
"SiteNavigation.Navigation
4. Before you get fancy and use variables, does it work if you hardcode an actual, valid value:
DoCmd.BrowseTo acBrowseToForm, _
ObjectName:="SnapshotRelat
PathtoSubformControl:="Sit
WhereCondition:="[apd__ent
...or even like this:
WhereCondition:="[apd__ent
JeffCoachman