Solved

How to stop tabbing to fields with data in?

Posted on 2011-02-21
6
288 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
  • 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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 

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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

822 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