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 
Option Group After Updates
Catherine Wartgow 
     
13 months ago
I have a VBA so I can get All Years, This year, and last year. However I can not figure out how to get last year. Please help.
Private Sub grpChoice_AfterUpdate()
Dim dDate As Date

Select Case grpChoice.Value
    Case 1: dDate = "1/1/1990"
    Case 2: dDate = "1/1/" & Year(Date)
    Case 3: dDate = "1/1/" & Year(Date)
End Select

Me.DirtSubF.Form.Filter = "[DirtDate]>=#" & dDate & "#"
Me.DirtSubF.Form.FilterOn = True
If dDate = "1/1/1990" Then
Me.DirtSubF.Form.FilterOn = False
End If
End Sub
Kevin Robertson  @Reply  
          
13 months ago
Dates should be enclosed in # not quotes.

DateAdd
DateSerial
Kevin Robertson  @Reply  
          
13 months ago
To get the first day of this year:
    dDate = DateSerial(Year(Date), 1, 1)

To get the first day of last year:
    dDate = DateSerial(Year(Date) - 1, 1, 1)
Catherine Wartgow OP  @Reply  
     
13 months ago
dDate = DateSerial(Year(Date) - 1, 1, 1) Unfortunately this did not work to pull last year date. Any other ideas?
John Davy  @Reply  
         
13 months ago
Hi Catherine, Kevin is correct. Try DateAdd. I am uploading a screen clip for you. Watch Richards video on DateAdd. HTH  John
John Davy  @Reply  
         
13 months ago

Catherine Wartgow OP  @Reply  
     
13 months ago
Ok I under stand now but I want it to show me every date between 1/1/2024 and 12/31/1994. How do I state that?
John Davy  @Reply  
         
13 months ago
Identify the firstselecteddate and lastselecteddate and use  Between or >=   <= in a query

John

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/1/2026 11:43:28 PM. PLT: 1s