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 
Disable Button
Christopher Jones 
    
4 years ago
Hi all, I'm new to VB coding and not fully understanding of how a lot of it works yet. I'm certain it's the "On Update" property but I'm not sure.

My database has a form that fills in the time and date at the push of a button. I am then trying to lock the button, making it longer usable for that "CURRENT" record only. I still want it to appear on other records.

The only issue is, my form needs to be manually saved. So if someone accidentaly clicked the Time/Date button then clicked the close button realising their mistake. I'd still need the button to appear next time they went to the record.

I hope this makes sense.

I'm currently using this code behind my button.

"Private Sub btnFillDate_Time_Click()
Me.txtDateOut.Value = Date
Me.txtDepartureTime.Value = Time()
    Me.btnFillDate_Time.Locked = True
End Sub"

Christopher Jones OP  @Reply  
    
4 years ago

Kevin Robertson  @Reply  
          
4 years ago
Buttons don't have a locked property. You could however disable the button.

You don't need the Me. throughout your code. The current form is assumed. Bang v Dot.

Private Sub btnFillDate_Time_Click()

    txtDateOut = Date
    txtDepartureTime = Time()
    btnFillDate_Time.enabled = False

End Sub

Depending on what else you need to do you may need more.

Have you watched Intro to VBA yet?

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/8/2026 5:10:07 AM. PLT: 1s