?
Solved

How to stop tabbing to fields with data in?

Posted on 2011-02-21
6
Medium Priority
?
301 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
Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

 

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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

850 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