473,387 Members | 1,542 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to display a navvigation control content based on selection of another nagivation

I am using a navigation form with top navigation control named as "NavigationControTop" and left navigation control named as "NavigationControLeft". The subform where the main content is displayed is named as "NavigationSubform"

I had written VBA code for user control to display different content in "NavigationSubform" when the user log in.

Once a user log in, I had placed a code to set the focus to the related tab in the "NavigationControTop", the navigation button for the tab is "nvbProduction":

me!nvbProduction.SetFocus

This works, but does not seems to activate the navigation button.

I had also placed a code in the VBA to display the correct content in the "NavigationSubform" as below:

Me!NavigationSubform.SourceObject = "Nav_DeptMainPage"

This works too.

The problem I faced now is How to display the correct content in "NavigationControLeft".

I had set different navigation buttons in the "NavigationControLeft" which display different sub menu and a different department is clicked in the "NavigationControTop", which works properly. But in VBA code, how am I going to refer to the different content?

I tried:

me!NavigationControLeft.setfocus
me!NavigationControLeft.requery

but does not work.

Any body can advice please?

Thank you
Beh Kea Chang
Aug 24 '14 #1
5 1548
jimatqsi
1,271 Expert 1GB
kcbehnet, Be sure to get in the habit of putting your lines of code inside Code tags. With one line it doesn't make much difference but longer samples of code are much more readable like that. Just click the [CODE/] button and put your code between the tags.

SetFocus merely makes a control the active control, it does not activate it. What you need to do is run the code that runs from the activating event. With a button it's the OnClick event. With a listbox or combobox it's the AfterUpdate event. In this case, I suspect it is the OnClick event. Whatever the name of that event code is, that's the subroutine you want to run. So it should be as swimple as
Expand|Select|Wrap|Line Numbers
  1. NavigationControlLeft_Click()
Give that a try.

Jim
Aug 24 '14 #2
Dear Tim,

Thank you for your suggestion, but it does not work for my case.

I am using the auto Navigation form of Access 2010. So there is no event set for the navigation buttons.

When I select to set up Navigation form with Top horizontal NavigationControTop and left vertical NavigationControLeft. There seems to be some hidden code by Microsoft the automatically operated. When I click on a Navigation (say nvbProduction), it loads a form into the NavigationSubform and at the same time it make the left NavigationControLeft to reflect the sub-menu for the Production department.

As I am setting up user log in to the system, I used some code in the Form load event to set the related departmental navigation buttons to default (in this case, the nvbProduction button).

So when the nvbProduction button is default, I open form Nav_DeptMainPage in the NavigationSubform with the following code:
Expand|Select|Wrap|Line Numbers
  1. Me!NavigationSubform.SourceObject = "Nav_DeptMainPage"
I plan to open the related "navigation buttons group" in the NavigationControLeft navigation control by the following code, but I do not how to refer to the related "navigation buttons group" which was automatically setup by Access when I add in extra Navigation buttons in Layoutview.
Expand|Select|Wrap|Line Numbers
  1. Me!NavigationControLeft.SourceObject = "navigation buttons group"
The "navigation buttons group" is unknown to me as it was set up by Access automatically.
Aug 24 '14 #3
zmbd
5,501 Expert Mod 4TB
Your answer is here:
+ http://bytes.com/topic/access/answer...rm#post3771117

With more information via
+http://bytes.com/topic/access/answer...rm#post3771135
Aug 27 '14 #4
I had tried the docmd. browseto command. It does not work.
Aug 28 '14 #5
zmbd
5,501 Expert Mod 4TB
When you say, it doesn't work, that is a very nondescript statement. It gives no detail as to what you wanted to happen, what did (or did not) happen, code, form design, errors, etc...

The docmd.browseto method works just fine in the databases I use it in.
For example..
I have a two tiered Navigation Control.
ACC2010-NavCtrl>TierOne>SubTierToTierOne

SO:
ACC2010-NavCtrl>Items>ItemInventory
This loads a form in the navigationsubform that shows the basic inventory item information such as serial_lot_number, partnumber, description, etc.... the Primary Key field is set so that on click event takes the selected record, pulls the primary key and uses it in the "wherecondition" parameter (mind you it's a properly formated SQL where clause string) to "switch tabs"
ACC2010-NavCtrl>Item>ItemHistory
So with a nice single click, I move from the one line inventory record to the records that log the cradle to grave.
This form also has event code that upon entering a new item into the inventory, once confirmed, an entry is made into the history log indicating when the item was entered into the database and then browses to the ACC2010-NavCtrl>Item>ItemHistory so that additional entries can be made such as when the item was actually received and who received it, etc...

Or, I have:
ACC2010-NavCtrl>Facility>OpLocations
This button loads the form in the navigationsubform that has a parent with the operational locations as recordsource with a child subform that pulls the items (same format as ItemInventory)currently checked-out to that OpLocation.
Once again, the the Primary Key field of the childform is set so that on click event takes the selected record, pulls the primary key and uses it in the "wherecondition" parameter (mind you it's a properly formated SQL where clause string) to "switch tabs" to
ACC2010-NavCtrl>Item>ItemHistory

So it works if the command is used correctly and the forms are designed properly to handle the navigation.
Aug 28 '14 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: AA Arens | last post by:
I have a form with navigation button and they brows through the records. How to change the order or the way these records are navigated? Like before based on ID, now I want based on another field,...
1
by: =?Utf-8?B?bmF0YXNoYQ==?= | last post by:
Good morning, I'd like and realize an Intranet page, in an Active Directory domain, showing customized content based on AD logon identity of client user requesting page. Is there any...
3
by: PowerLifter1450 | last post by:
Hi all, I have to Combo boxes on a form. The first one I would always like users to see. The second, however, I would like hidden if the first box has certain values selected. So, if ComboBox1 has...
3
by: kcddoorman | last post by:
Environment: Windows 2000 Server IIS 5.0 Access 2003 IIS is set up for basic authentication. This means I can set rights for logged in users using NTFS file permissions. This all works well for...
4
WyvsEyeView
by: WyvsEyeView | last post by:
I am doing the very standard thing of filtering the contents of one combo box based on another combo box. I've done it many times, but always on a main form. Now I'm trying to do it on a datasheet...
1
by: redgoals | last post by:
Hi All, I will be creating a white label website for car hire dealers. My main website will be called something like: carhire.com, the content on carhire.com will be pulled in from a database. ...
1
by: soni2926 | last post by:
hi, we're building a site which will have common pages for different users, but certain sections will show different content based on the membership of the logged in user, like admin, manager,...
7
by: simulationguy | last post by:
This is causing my some grief :) I have a form that displays records in a tabular format, one field is a combo box that displays values from another table. But I only want some of those values...
1
by: amitshil | last post by:
I am going to develop a mini project on content based image retrieval but i m not clear about the algorithms i need to implement.can anybody plese suggest
0
by: hosny | last post by:
I have a datagridview with the following column using visual basic 2005 1-First column is country code as DataGridViewTextBoxColumn 2-Second column is country name as DataGridViewComboBoxColumn...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.