?
Solved

Control actions on Navigation Form's Navigation Button.

Posted on 2014-09-05
5
Medium Priority
?
1,473 Views
Last Modified: 2014-09-08
I am using a Navigation Form in access 2010 for a property management application. I want to have different controls for "Add Property" and "Edit Property", but I only want to design and use one detail form. Each control seems to have one unique detail form attached to it. Say I attach the same detail form to both buttons, how do I control that in one case the form opens in add mode and in the other case in edit mode.screenshot
0
Comment
Question by:Fritz Paul
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 85
ID: 40305652
I don't think you can do that, using the Navigation Buttons. From what I've been able to tell, those buttons just open a Form, and nothing else. You'd have to have two different forms, and that could be troublesome from a maintenance standpoint.
0
 
LVL 38

Expert Comment

by:PatHartman
ID: 40305875
I don't use the navigation form.  It is too limiting in a large application so I just create my own tabbed forms if I want that style.  I also never open main forms directly to a record.  I always create my applications to work in a client/server environment since I either know from the beginning the BE will be upsized to a server based database engine or that perhaps some time in the future the need will arise and I don't want to have to rework all the forms to be good client/server citizens and the navigation form just doesn't fit the bill.  It is designed to help novices who can't build their own tabbed form or to replace the switchboard which everyone pans but which I use in almost every app.  It's not slick but you can make it look better than it did in the past by adjusting the properties of the buttons and labels and you might actually like it:)

If you have a way of identifying which button was pressed, you can use that in the Activate event to move to a new record when the "add" button is pressed.  I'm just guessing that the Activate event would be appropriate.  I don't know if that event fires for subforms when they get the focus.  If the Activate event doesn't fire, you might try the Current event but don't forget to check first if you are on a new record or you'll put the app into a never ending loop.
0
 
LVL 29

Accepted Solution

by:
IrogSinta earned 2000 total points
ID: 40307149
@Fritz
This is how you'd do this:
Private Sub NavigationButton1_Click()
    Me.NavigationSubform.Form.DataEntry = 1
End Sub

Private Sub NavigationButton2_Click()
    Me.NavigationSubform.Form.DataEntry = 0
End Sub

Open in new window

@Pat
I too am an avid user of tab controls; however, another expert pointed out the advantages the navigation control has over the tab control and the accompanying video in the link is quite impressive.  Here's an excerpt from msdn that explains it:
Comparing the Navigation Form to the Tab Control
 You may wonder why you might use the new navigation form feature instead of the standard Tab control, which provides similar functionality. One reason, of course, is that the Tab control does not provide a mechanism for supporting a hierarchy of options, as does the navigation form. To enable users to select a main category, and then select sub-categories, the navigation form is the only choice.
 In addition, the load-time behavior is different for the two types of controls. The navigation form loads each child form or report on demand (that is, as you click the corresponding tab). The Tab control, however, loads all its child objects as it loads. Not only does this affect performance (when you open the main form, you must wait while the Tab control loads all its child objects), but it can also make it difficult when handling querying data. Because the navigation form loads each form as you click the corresponding tab, you can be certain that users see the most current data, without a need for you to create specific code that re-queries the form as users click each tab. This also means that the navigation form does not provide a specific event as you click each tab. Instead, place the load-time code in each form or report Load or Open event handler.
Be sure to check out the video in this link.  It was an eye opener for me:
http://msdn.microsoft.com/en-us/library/office/ff851947%28v=office.14%29.aspx

Ron
0
 

Author Closing Comment

by:Fritz Paul
ID: 40307729
I like and appreciate Pat's reply a lot. However Ron is answering the question and I appreciate the link that he advised and the video which he pointed out.
I learnt about the use of the Navigation control and that the navigation form will not open in versions before A2010 (at the end of the video).
Thanks,
Fritz
0
 
LVL 38

Expert Comment

by:PatHartman
ID: 40310296
One other problem I found with the navigation form (and actually the reason I don't use it) is that it is limited to 5*5 items.  I frequently have apps with lots more menu selections.  One current app uses 56 items across 6 "switchboard" forms.  BTW, I increased my switchboard from 8 to 12 items and may go to 16.  It is just one line of code that needs changing, plus of course, you need to add the additional controls.  My switchboard is left over from A2003 since that was the last one that used VBA.

I agree that loading subforms as needed rather than all at once is more efficient but you can do that yourself if necessary with a tabbed form.
PS - the file paths at the top show only for me.  The users don't see them.
Switchboard with bubble buttonsSwitchboard with image in background
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Suggested Courses

743 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