473,900 Members | 4,979 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I Navigate to Next Tab Automatically

12 New Member

I am trying to create a data entry form for a large database. There is a parent form with 6 forms linked with a one-to-one relationship (due to a large number of fields) and several tables linked with a one-to-many. All have auto update/delete checked. The date entry form uses tab control (across 11 tabs) and subforms for some of the tables. I have two problems...

Firstly, ** Edit Form Doesn't Display Existing Data **

Secondly, when using the tab key to move through the fields in the table, when I get to the end of a tab control, instead of moving to the next tab control for the same record, it moves to a new record on the same tab.

I am fairly new to access and not familiar with all the code etc behind it, so I would be grateful for any advice!

Dec 15 '11 #1
12 14160
32,584 Recognized Expert Moderator MVP
I would suggest you take this a number of steps back first. What you are planning is not a usual approach and is quite flawed in concept. Due to the unusual nature of your approach, and the relative lack of detail in your question, it's hard for someone to guess at what you want with enough detailed accuracy to allow appropriate alternatives to be suggested. What you describe is the normal behaviour of subforms.

An alternative to consider would be a single form with tabs, but having bound fields on each tab, rather than separate sub-forms.

That said, I expect the best advice I could give would be to revisit your overall design, starting with the data structure (I can think of no situation where one-to-one relationships would be desirable. There may be possibilities here, but very few I expect).

Following closely behind that would be to try out your concepts with a structure which is considerably simpler until you are sure they can handle what you need. Only then build the extra complication into your design. Otherwise you should sensibly expect all sorts of related (to the complexity rather than the concept) problems.
Dec 15 '11 #2
Rachel Turner
12 New Member
Hi, thanks for your reply. I'm sure the design is not ideal as I am a beginner in Access! The database is for data from a very long household survey, and there are >255 fields in the main table so I had to split it into at least two tables with one-to-one (perhaps it would have been better to stick to 2?). I am not sure how I can get around the problem of one-to-one tables with so many unique fields?

I have a single form with tabs, and many of the fields are in bound fields on the tabs. However I could not add all of them in this way (I assume this was again becuase of the large number of fields). All the one-to-many are in subforms. I should have said that the tab key issue is not with the subforms but with the bound fields which are the last fields on each tab (I appreciate that that is the normal behaviour in subforms).

Grateful for any advice!
Dec 15 '11 #3
32,584 Recognized Expert Moderator MVP
First of all, my original advice still applies. You will still find the whole process more reliable if you remove many of the complexities involved with such a complicated setup. However, I'll leave that with you for now and consider the distinctly non-newbie problem's you're faced with.

I would first consider using a BeforeUpdate event procedure for the form which cancels any update except those that are triggered in the way you choose. The obvious solution here would be to provide a Command Button control that the user must click on to save any record.

Next you'd need to determine what happens, IE. which events are triggered, when you trigger a save (that is cancelled) by moving past the last control on the tab. When you can reliably handle this situation you can place code in the relevent event procedure which passes control to the next page instead.

Does this sound like it makes sense?
Dec 15 '11 #4
Rachel Turner
12 New Member
Thanks - this makes sense in theory but I have no idea how to do it... will go away and do some reading! I did have a similar but simpler database which had just one main form and several subforms, and the tab controls all worked fine. I also had a previous version of this database with one form plus subforms, which I had created in the same way but had the problem with the tab key - I have been through all the properties and built it up from scratch again but I cant figure out what's different. Thanks for your help...
Dec 15 '11 #5
759 Contributor
In my opinion is almost impossible to have an object with more than 255 properties.
I think that this is also the reason of Access designers to limit the number of fields (at a very large range: 255).
So, every time I hear about, I suspect a (very) poor design of database.

Take a look here:
and see if you don't change your mind about store more than 255 fields (properties for a SINGLE object, in fact) in a single table.
Dec 16 '11 #6
446 Recognized Expert Contributor
Obviously I agree that you have a highly complex situation and endorse the previous advice to simplify if possible.....

But to address the mechanics of where you are stuck, Move between Tabs, there are some variations which may seem complicated due to your complex situation. But there is logic so stay with me..

First you understand that you have Parent form. It seems that some of the fields from the Parent recordset may be grouped on individual tabs because of shortage of space.

This is the most simple case, where the next field you want to move to belongs to the same recordset i.e. not in a new sub-form. You just put some code in the Lost Focus event of the last field on your current tab to set focus to the next field you want to visit. Even if it is on a different tab-page, Access will find it and put the focus there (so long as the field is Enabled).

If you are moving from a field in the Parent recordset to a field in a Sub_Form on another tab, there are three options;
  1. Move to the sub-form control
  2. Move to a control within the sub-form
  3. Move to the Tab Page

The first option is the simplest, just setfocus to the sub-form. The preset Tab-Order within the sub-form will then take over.

If you want to move to a specific field within the subform then you need the second line in the example below. This assumes that PhonesCustomers is a sub-form in a tab-page listing the one-to-many contacts within a customer's organisation. First set focus to the sub-form then move the focus inside it to the control you want.
Expand|Select|Wrap|Line Numbers
  1. Private Sub ExchangeRate_LostFocus()
  2. Me!PhonesCustomers.SetFocus
  3. Me!PhonesCustomers.Form!PhoneNumber.SetFocus
  4. End Sub
The third option does much the same as the first. The tab-control has a name of its own (I have one called TabCtl72) and each tab has a Page number starting from 0 (zero). You might need to use this option in a Read-Only situation, where none of the controls in the sub-form will accept focus.
Expand|Select|Wrap|Line Numbers
  1. Private Sub ExchangeRate_LostFocus()
  2. Me.TabCtl72.Pages(2).SetFocus
  3. End Sub
The next problem is when you are in one sub-form and want to move the focus to another field in another sub-form. Here you have to issue three seperate commands, first to move up to the Parent form from within the first sub-form. Then to move focus to the next sub-form; and finally to a specific field.
Expand|Select|Wrap|Line Numbers
  1. Private Sub PhoneNumber_LostFocus()
  2. Me.Parent.SetFocus
  3. Me.Parent!NextSubform.SetFocus
  4. Me.Parent!NextSubform.Form!NextField.SetFocus
  5. End Sub
Note that all three commands are directed via the Parent form.

Dec 16 '11 #7
2,322 Recognized Expert Moderator Top Contributor
Could you please try to describe what the general purpose of your application is, what it is you need to achieve with it? What kind of information are you gathering, and for what purpose.
Dec 16 '11 #8
759 Contributor
Hi S7 !
Forget me, but I can't understand how is fired the _LostFocus event for the sub_form.
Dec 16 '11 #9
32,584 Recognized Expert Moderator MVP
I can't understand how is fired the _LostFocus event for the sub_form.
That was never mentioned in S7's post. Only the last control on the form, that is within the sub-form, needs it's LostFocus event handled.
Dec 16 '11 #10

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

Similar topics

by: sophocles the wise | last post by:
automatically post data & click buttons on sequence of web pages with AxWebBrowser Hi, I need to post stuff everyday to a website and am working on a VB program to do this for me. I am a computer technician and I post an ad on craigslist.org everyday but sometimes I don't have time to do this. So, I accomplished so far to load the first page and post my ad in the textbox, with title and email address, and to alter the radio button and...
by: Patrick Coghlan | last post by:
I want to create about 4 forms with the same dimensions and background colours, similar to the forms one has to traverse when installing various software packages. I'm using Visual Studio and C++ (changing to C# soon) and can create separate forms, but I really just want to clone the first one, have the user select different options on each form and navigate between them via the PREV-NEXT-OKAY-CANCEL buttons on the bottom of the form. ...
by: husamal_ahmadi | last post by:
Hi everyBody: I have this question which really drive me cruzy, By using VB.Net: How can I let the internet explorer navigate in the same window either by using win32 API or by using Microsoft Internet Control refreance to my project ? some body toled me to use ShellExcute Function in API but I tried it
by: zek2005 | last post by:
Hi!!! I've made a form with a 'select' statement through a echo('<select name="res">'); echo('<option selected value=""> Select option</option>");'); while($row = mysql_fetch_array($resumen)) { echo('<option value="' .$row. '">' ..strtoupper($row). '</option>');
by: Peter Newman | last post by:
i have a dataset and want to step thrpugh each row each time a user clicks a button,
by: samueltilden | last post by:
I started a new job and the version of Visual Studio 2005 that I am now using does not have the Navigate Backward Button nor the Navigate Forward Button in the Standard Toolbar, and they are not available when I Add or Remove buttons from the Standard Toolbar. (I had these two buttons in the VS 2005 of my previous job). How can I add them? How can I add them easily. I googled this subject and found only that
by: Robert Dufour | last post by:
Vs2005, .Net 2.0, vb.Net, Winforms I have a form with a binding source, a binding navigator, a table adapter and a dataset (all using sql 2005 same table, to keep it simple) When the user tries using next, previous, first or last, or closes the form I would like to automatically detects if any changes were made and if so do an update. If the update was unsuccessful, user should not be allowed to navigate nor close the form until problem...
by: Tina | last post by:
How can I programmatically navigate a website just as a user would? click on buttons, hyperlinks, etc. I know how to read nodes using XPath but I don't know what classes to use to navigate. I have to write a program to automatically read mail from an html mail system. Thanks, T
by: esurkes | last post by:
I have been able to create a web browser control in a form that properly opens a website based on an address from another form. Now I am trying to figure out how to set the corresponding username/password in the webpage automatically using vb. Does anyone have any idea how to do that? Here is the script I used to open the browser: Private Sub Form_Current() If Len() > 0 Then wbbWebsite.Navigate URL:= Else ...
by: Adam Tippelt | last post by:
Scenario: I've got a table for adding records, with a subtable for all data requirements related to that record. I've built a 'view' form to navigate through the records, so that you can view the details of each. This includes a listbox to display the list of data requirements attached to each record. I've made navigation buttons using the control wizard and converted them to VBA to allow more flexibility so that I can add code to them. ...
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.