[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

How to stop tabbing to fields with data in?

Posted on 2011-02-21
6
Medium Priority
?
299 Views
Last Modified: 2012-06-22
Hi all,

I have a continuous sub form with 10-12 fields on.  I have added checkboxes to the top of the form to say that if the checkbox is ticked the field becomes enabled.  This works fine when there is no data in any of the fields.  You tick the check box, the field becomes enabled and you can tab down filling in the data for all users.  

However if you later go in to add figures to a different field and tick the check box to enable that field it will tab to the previously completed field because there is data in it.  

Sorry if this is hard to understand.  Is there anything that I can add to this code so it only goes to the enabled field and not any other field that may have data in?

Private Sub Check_Absence_AfterUpdate()

 If Me!Check_Absence = True Then
    Me!Absence_Score.Enabled = True
    Me!Absence_Score.SetFocus
  Else
    Me!Absence_Score.Enabled = False
  End If

End Sub

Open in new window


Regards

Chris
0
Comment
Question by:smods
[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
  • 3
  • 3
6 Comments
 
LVL 10

Expert Comment

by:VTKegan
ID: 34942656
I would use an option group at the top of the form, this way only one field could be enabled at a time.

You would then set an afterupdate event of the option group to set only one field to enabled to prevent tabbing to a control that is not enabled.
0
 

Author Comment

by:smods
ID: 34942721
Thanks VT.

All fields are currently not enabled when opening them form.  It's only when the check boxes are ticked that they become enabled.  However, even when the checkbox isn't ticked anything with previous data in can be edited.  Is that right?  Should it do that?

Regards

Chris
0
 
LVL 10

Expert Comment

by:VTKegan
ID: 34945558
Can you upload an example file.  

based on your code if you have a check box like this for each field, then it looks like you could enable more than one field.

So if you are not setting every other field enabled = false then you have more than one field enabled.  If you use an option group you could dramatically reduce the amount of code needed.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:smods
ID: 34950887
Here you go VT.


ee-example.mdb
0
 
LVL 10

Accepted Solution

by:
VTKegan earned 2000 total points
ID: 34951223
smods,

Here is the revision.  What I did: I edited your existing code to set the Tab Stop Property of the form to True and False based on the check box and that fixed the tabbing to the other controls.

I also created a new example that uses an option group.  Open up the main form that I created, and look at the code there.  I replaced about 100 lines of your code in about 15.  Just food for thought.  Both forms are working as you would want them, just another alternative.
ee-example--1-.mdb
0
 

Author Closing Comment

by:smods
ID: 34951943
Good job!! I really liked your idea so have implemented that instead!

Thanks

Chris
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

650 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