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 
Date to Only Show Month and Day Not Year
Brent Davis 
     
12 months ago
I want to have a text box where I enter only the month and day and not include the year so I can do a search based on those months only. I will have two text boxes for the user to type in the years to compare, i.e textbox1 as Year1 and textbox2 as Year2.  Then compare the months in the other text boxes and show the results. Any assistance is appreciated.
Sami Shamma  @Reply  
             
12 months ago
Hi Brent.

Are you comparing these fields day, month, year1 year2 to actual date type Fields in the database.
Please be more specific. See Rule #2.
Brent Davis OP  @Reply  
     
12 months ago
Yes sir.
Brent Davis OP  @Reply  
     
12 months ago
Sami, year1 and year2 are just the year, 2024 and 2025. The date in my table is  an actual date. I want to be able to enter the month and day with no year and search those months based on the years in the year1 textbox and the year2 textbox.
Jeffrey Kraft  @Reply  
      
12 months ago
Personally, and it's because I like it.  Richards Search as you type video.  I have a text on a form that is named "MyDateSearchBox"

On Change Event:

Private Sub MyDateSearchBox_Change()
    'Search for Dates
    On Error GoTo MyErr:
        Me.RecordSource = "SELECT * FROM YourTableNamesTbl " & _
            "WHERE " & _
            "VideoDate LIKE ""*" & MyDateSearchBox.Text & "*""" & _
            "ORDER BY YourTableNameTbl.WhaeverID; "
    
    
exit_MyErr:
            MyDateSearchBox.SetFocus
            MyDateSearchBox.SelStart = Len(MyDateSearchBox.Text)
            
            
Exit Sub
MyErr:
MsgBox "No Matches Found, Now Resetting", vbCritical, "Error"
    MyDateSearchBox = Null
    Me.RecordSource = "Select * FROM YourTableNamesTbl"
    MyDateSearchBox.SetFocus

Exit Sub
End Sub




Jeffrey Kraft  @Reply  
      
12 months ago

Brent Davis OP  @Reply  
     
12 months ago
Thanks all! I was able to get it to work but I could not get it to work with a combo box for the month.  I just set up a text box and entered the corresponding number with the month(January =1) in a StartMonth textbox and then an EndMonth textbox.  When I tried to set up the combo box to display the month name I tried a couple of ways. I created a table with only the month and the coordinating number(January = 1). If I asked for records between January and March it would return revenue numbers for January through March but also Oct, Nov, Dec revenue numbers.  Then I tried creating a query calculating the month number and the month name and using the query to make combo boxes for start and end month and I received the same results as the other method with combo boxes. What am I missing? Thanks for any assistance.
Brent Davis OP  @Reply  
     
12 months ago
Got it to work the way I wanted but had to use a “cheesy” method.  The SQL was apparently treating the MonthNumber field from my table as a string so the  number 1 was not being recognized as a number from the combo box. So I created a text box(made it invisible) on the Val of the combo box and it works now.  I know there is a better way but it works the way I wanted it to. Thanks all.

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 5:55:02 AM. PLT: 1s