Solved

How to stop tabbing to fields with data in?

Posted on 2011-02-21
6
293 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

Author Comment

by:smods
ID: 34950887
Here you go VT.


ee-example.mdb
0
 
LVL 10

Accepted Solution

by:
VTKegan earned 500 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Familiarize people with the process of utilizing SQL Server stored procedures 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 Micr…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

738 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