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 
Click Event Current Date
Joshua Rivera 
    
3 years ago
Hello:

Having some difficulty understanding why, when I click on my Yes/No checkbox, my code for autoupdate Date field is not allowing me to enter in the "()" after "Date()". Here is the code that I am using:

Private Sub DataEntry_Click()

    If Me.DataEntry = True Then
        Me.CompleteDate = Date
    Else
        Me.CompleteDate = Null
    End If

End Sub

When I check yes, I want the Date Field to update with the current date.

Thanks in advance!
Dan Jackson  @Reply  
            
3 years ago
That's by design. Date in VBA is the same as Date() everywhere else.
I'm sure one of the guys can give a technical reason for it but it should work just fine
Joshua Rivera OP  @Reply  
    
3 years ago
When I use this code and run it, the Date field is not populating with a date. There is no formatting, or defaults set for the Date field either.
Joshua Rivera OP  @Reply  
    
3 years ago
Figured it out:

If Me.DataEntry = True Then

needed to be:

If Me.DataEntry = Yes Then
Kevin Robertson  @Reply  
          
3 years ago
I wouldn't name any field DataEntry as it is one of the Form Properties.

When you enter Me.DataEntry Access is looking at the Form Property, not your Check Box.
If you really need to name it DataEntry use a Bang (!) instead. Me!DataEntry

Bang! v Dot.
Joshua Rivera OP  @Reply  
    
3 years ago
@Kevin Robertson
Thank you, I did not realize that would create an issue. I'll need to do some re-labeling.

@Dan Jackson
Thank you for the information when using "Date" in VBA.

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 6:50:01 PM. PLT: 5s