Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   Index   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Home > Forums > Access
Back to Access Forum    Comments List
Setting Tab Order Invisible Fields Upload Images   Link   Email  
Jim Byers 
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.

Help!
Jim Byers 
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.
Cheers
Jim
Richard Rost 
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 
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 
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 
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
or
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 
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)"

Cheers
Jim
Richard Rost 
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.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

 
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2024 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 3/28/2024 5:45:50 AM. PLT: 0s