Access 2007-2019
Access 2000-2003
Access Seminars
TechHelp Support
Tips & Tricks
Access Forum
Course Index
Topic Glossary
Insider Circle
Home   News   Courses   Tips   Templates   Forums   Help   Order   Contact   Logon  
Microsoft Access Forum

Forums > Access

Welcome to the Microsoft Access Forum. Access is by far our most popular topic here at Computer Learning Zone. This forum is for everyone to read but only students (paid customers) can post here. If you'd like to become a student, you can watch Access Beginner Level 1 for free, and then purchase Level 2 for just $1.00 here. After you create a logon, you will have full access to the Forums.

Subscribe to this forum and receive an email update whenever new posts are added. You will also be notified by email if any conversations you are involved in receieve new comments. Yes, even non-students can subscribe to update notifications.

Click Here to Post a comment and start a new discussion!

Setting Tab Order Invisible Fields Link 
Jim Byers    
Sat 6/27
A question about 'Tab Order' if I may.

I have a form laid out in the usual manner and have successfully edited the tab order so it goes from left to right and then down one row to repeat left to right skipping the fields that are calculation fields.
All good, except....the last field in each row may be visible or invisible on any given record depending on whether or not a checkbox is ticked to true or false for that particular record.
Both of these fields are positioned on top of each other but only one is visible at any given time depending on the value in the checkbox. The data entered into each goes into its own field in the table.

At present, the tab order is set and working correctly for the visible field. But move to the next order which has the alternate field now visible, tab skips that field entirely.

Have you come across this issue before? I cant even figure out a good search term to use to ask Google for help. How to set tab order on an invisible field? Stupid question. If it's not visible how is it going to get focus? Because on another record it will be visible.

Jim Byers   
Sat 6/27
Ok, this is embarrassing.
I went away from the problem for a while and the answer popped into my head while thinking about something else.
Came back, tried it. It worked.
Put both the visible and invisible fields in the list directly one after the other.
Of course, Access ignores the invisible one.
Sorry to take up your time.
Richard Rost    
Sat 6/27
You got it. Non visible fields aren't stopped at in the tab sequence. Never a waste of my time. I love helping.
Richard Rost    
Sat 6/27
If you don't already - make sure you have your OnCurrent event show/hide whatever fields are supposed to be visible or not IN ADDITION TO whatever OnClick or AfterUpdate events you've got going on. Cycling thru orders can change what you need to see.
Jim Byers   
Sat 6/27
Would be most appreciative of any comment you care to make.
Heres a snippet of the VB code for 2 fields only.
The full version goes on for a total of 22 different fields and labels.
Comments are mine.

Private Sub GSTIncluded_AfterUpdate()

  Me.Label350.Visible = Nz(Me.GSTIncluded = True, False) 'Turns one box on - Put No GST Relevent Item on This Line
  Me.Label351.Visible = Nz(Me.GSTIncluded = False, True) 'Turns a second box off - Put GST Included Relevent Item on This Line

  Me.ItemCostIncGST.Visible = Nz(Me.GSTIncluded = True, False)
  Me.ItemCostNoGST.Visible = Nz(Me.GSTIncluded = False, True)

End Sub

Also, the same is repeated for Private Sub Form_Current() as well.

I didnt write the code. It was copied straight off an Access site after a Google search.
With my very limited knowledge of VB so far it all looked straight forward. And just last night watching your Dev7 course I learnt that Nz. isn't referring to New Zealand :-)
Richard Rost    
Sun 6/28
You shouldn't need the NZ function unless you're dealing with triple-state checkboxes. They will either be true or false, and not NULL. So you can say:

Label.visible = GSTIncluded
Label.visible = NOT GSTIncluded

Depending on what you need.

Most of the time you don't need to specify Me.

Also, don't repeat code in two places. Make your own Private Sub and then call it from both the AfterUpdate and Current events.

Aside from that, looks good.
Jim Byers   
Sun 6/28
Thank you Richard.
The NZ has been removed. I'll leave the making of a private Sub for now as it is beyond my capabilities at this time. I've got one more lesson in beginner to go before I move on to the next level. I assume the nuts and bolts of doing what you suggest will be covered at some stage. I'll edit it then, as it seems to be working fine for now. Presumably, the reason behind your suggestion is speed, and at that this stage that's not an issue, yet.

One question though if I may.

Another snippet of VB code I came across before I found this one had just "Me.GSTIncluded = True" instead of the True, False) in this one.
The first example made sense to me, I read it as "If THIS, then True". Sounds logical.
The code I'm using sort of reads to me as  "If THIS then True, else false.

Remember, rank beginner here. Do you mind quickly explaining the logic behind "True, False)"

Richard Rost    
Sun 6/28
You were using the NZ function before which stands for "NULL ZERO." It basically allows you to take a NULL value and specify another value for it. It's handy for functions like DLOOKUP when you're not sure if the value will be in the table or not. You can say:

CustomerID = DLOOKUP("CustomerID","CustomerT","LastName='Smith'")

If there is no customer with a LastName of Smith then you get a NULL value which will cause an error in your code. You can wrap that in NZ so that it will return a ZERO or any value you wish when this happens:

CustomerID = NZ(DLOOKUP("CustomerID","CustomerT","LastName='Smith'"),0)

I think NZ is a bad choice for the code you had before because unless you specifically make a checkbox "triple state" then it can't have a NULL value. So a True/False value would have been just fine.

If anything, that code should have used the IIF function.
Add a Reply

Show All Posts


Post Your Comments
Only students may post right now. Click here for more information on how you can set up an account. If you are a student, please LOG ON first.

You may want to read these articles from the 599CD News:

6/30/2020Access Seminars
6/29/2020Access Create Duplicate Record
6/28/2020Access Times as a Duration
6/25/2020Access D14 Lessons 2, 3 Ready
6/20/2020Access Developer 14
6/17/2020Access Time 12 hour NO am/pm
6/16/2020Access Handbook News
6/16/2020Access Developer 7 Handbook
6/7/2020Working on Access Dev 14
6/6/2020Access Beginner Level 1

Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Account Login
Online Theater
Lost Password
Free Upgrades
Insider Circle
Student Databases
Change Email
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Waiting List
Production Schedule
Collapse Menus
Live Chat
Customer Support
WalkThru Tutorials
Consulting Services
Affiliate Program
Richard Rost
Free Lessons
Mailing List
Video Tutorials
MYOLP Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Terms of Sale
Live Chat
General Info
Support Policy
Contact Form
Email Richard
Mailing Address
Phone Number
Fax Number
Course Survey
Facebook    Twitter

YouTube Channel    LinkedIn

Blog RSS Feed   
Keywords: microsoft access forum  PermaLink