Solved

Control actions on Navigation Form's Navigation Button.

Posted on 2014-09-05
5
1,068 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
5 Comments
 
LVL 84
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 34

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 500 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 34

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

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now