473,480 Members | 1,852 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How do I Navigate to Next Tab Automatically

12 New Member
Hi,

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!

Thanks
Dec 15 '11 #1
12 13988
NeoPa
32,556 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
NeoPa
32,556 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
Mihail
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:
http://bytes.com/topic/access/insigh...ble-structures
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
sierra7
446 Recognized Expert Contributor
Rachel,
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
  5.  
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
  4.  
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
  6.  
Note that all three commands are directed via the Parent form.

S7
Dec 16 '11 #7
TheSmileyCoder
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
Mihail
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
NeoPa
32,556 Recognized Expert Moderator MVP
Mihail:
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
Mihail
759 Contributor
My bad. Thank you, NeoPa !
Dec 17 '11 #11
Rachel Turner
12 New Member
sierra7 - thanks so much for your help! problem resolved!
Dec 22 '11 #12
NeoPa
32,556 Recognized Expert Moderator MVP
At this stage it would make sense to select the post that most helped you as Best Answer for the thread. As your thanks were reserved for S7 I assume it will be one of theirs, but only you can do that.
Dec 22 '11 #13

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

Similar topics

0
747
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...
6
2221
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...
7
4480
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...
2
1672
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))...
4
2245
by: Peter Newman | last post by:
i have a dataset and want to step thrpugh each row each time a user clicks a button,
2
9234
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...
1
2516
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...
2
3235
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...
1
1093
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...
8
2684
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...
0
6918
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
7057
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,...
0
7102
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5357
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4798
isladogs
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...
0
3008
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...
0
1310
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
570
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
199
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.