Solved

Access 2010 class of form navigation buttons?

Posted on 2013-06-10
8
667 Views
Last Modified: 2013-06-11
Many years ago I used FoxPro and loved the "class" concept. A the time, it was even extended to customized form navigation buttons.  When I design a form, I like to give my users a selection of buttons ( Next, Previous, Add Save, etc) that are bigger and also give me more control of what happens when they are pressed. In Fox, I could make the buttons once, grab hem as a group and place them on a new form.   This saved a lot of time vs creating each button for a form

Is there a way to do this in Access 2010?

Jerry
0
Comment
Question by:GNOVAK
8 Comments
 
LVL 84
ID: 39236494
Many people use a subform for this. Just create your subform, add the necessary code to make things work, and then use that subform as needed for nav buttons. If you set the subform and subcontrol properties correctly, it won't look like a subform (i.e. no border, etc etc).

Access supports classes, and can use them in much the same way that Visual Basic does. It does not support all concepts of OOP programming, but I've never needed anything class related that Access couldn't do.
0
 
LVL 47

Assisted Solution

by:Dale Fye (Access MVP)
Dale Fye (Access MVP) earned 500 total points
ID: 39236592
I generally just create these on the fly nowadays, putting them in the form footer.

At one point, I had a subform that I used that contained all of my custom navigation buttons, but the problem was that whenever you set the focus to a control on the navigation subform, the main form would save the current record.  I finally just decided to code these buttons in the forms footer each time I use them.

I generally have a subroutine called buttons, that I call in the click event of each of the navigation, Cancel, Save, and Close buttons.

The attached file is an example of the form, controls, and code I use for my navigation buttons.  These change occasionally, but are pretty standard.

You can copy the buttons from this form, then copy the code as well and paste it into any form, but you will need to make sure that the buttons are actually linked to the code in the properties dialog, event tab.
NavButtons.accdb
0
 
LVL 75
ID: 39236684
You can adopt Steven's Nav Button scheme for this:

http://www.lebans.com/recnavbuttons.htm

mx
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 

Author Comment

by:GNOVAK
ID: 39237582
fyed -
Like the centralized solution!
I haven't worked with clones of a recordset before.
Couple of questions. As I will have a LARGE dataset from Oracle, will cloning a recordset be an issue?
Does the clone allow me to add _ I didn't see any code for add..?
Any problems in multiuser environment?
0
 
LVL 57
ID: 39237767
Jerry,

<<In Fox, I could make the buttons once, grab hem as a group and place them on a new form.   This saved a lot of time vs creating each button for a form>>

 As an aside; forget anything you did with Foxpro except in concept only.   Access is a totally different animal and is not oop based.

  While it does have some inheritance in VBA for objects, it's not full inheritance and frankly, from my viewpoint, makes classes in VBA pretty useless (others will disagree).

 I've used both products and you just can't do things the same way with either.  Simple example; in VFP, almost everything is done via command window.  In Access, everything is pretty much GUI.

  A good example of that is the query designer in VFP...most VFP developers don't use it because it doesn't work all that well, while in the Access world, the query designer is used heavily.

  Another example, the data environment of a form in VFP far surpasses what you can do in an Access form.

 I often have said in the past that it was a shame Microsoft did not take the best of Access and roll it into VFP.   They would have had a killer product.   Sad to say though, those times are well past now.

Jim.
0
 
LVL 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 500 total points
ID: 39237958
1.  You should have not problem working with the recordset clone

2.  You can add records through the clone, but that is not the technique used here.  There is a "New Record" button just to the right of the Last button.  That will take you to a new record.  If you are using tables linked via ODBC from Oracle, you should be able to use this technique to add a new record.  However, if your Forms recordset is based on a stored procedure or pass-thru query to Oracle, that might not work.

3.  Should not be a problem for multi-user environment as each user is controlling their own form.  However, if you have multiple users that might be accessing the same record at the same time, then there are additional steps to consider.
0
 

Author Comment

by:GNOVAK
ID: 39239250
fyed -
A post question -
The BUTTONS sub doesnt appear to be moveable from the specific form because of a reference to ME.RecordSetClone.
The form name could be passed - just have to change the button call.
Did you do anything different?
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 39239468
I generally just copy the Buttons code from one form to another.  You could modify it to make it more generic by putting it in a generic code module and passing it a form as an argument, but the code for checking required fields in the save button is specific to a particular form, so I find it easier just to put it in the form where the buttons are located.
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Familiarize people with the process of utilizing SQL Server views 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 Access…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

829 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