Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Sensitive Data OnOFF
Ashlyn Talley 
    
5 years ago
Im new to VBA, with that being said Ive built a database for work in which I need certain fields on a record (sensitive data) to be hidden upon form load until called upon with a click. I am able to use the Visible property with VBA to hide a field but have not be able to figure out a way this can be done with a click of a button or label. As I would also need the next record for the same field(s) to remain hidden until called upon with a click.


Private Sub Form_Load()
    If Me.toggleFLD = 2 Then
    Me.Comments.Visible = False
    Else: Me.Comments.Visible = True
    End If
End Sub
Richard Rost  @Reply  
          
5 years ago
Don't use a toggle button. Use a command button (says just BUTTON on the toolbar). Your code looks good. You don't need the "Me" though unless you're referring to the form's properties. Put this code in the OnCurrent event so it runs when you move from record to record:

Comments.Visible = FALSE

Now in your command button, put:

Comments.Visible = TRUE

That's it. No If/Then needed.
Ashlyn Talley OP  @Reply  
    
5 years ago
Thanks Richard, seems I over-thought on this one, your solution was simple and elegant.
Richard Rost  @Reply  
          
5 years ago
Thank you. I firmly believe in KISS. :)

And Occam's Razor.

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

Next Unseen

 
New Feature: Comment Live View
 
 

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 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/6/2026 12:48:15 PM. PLT: 0s