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 
Used ChatGPT to list distinct
Dan Jackson 
            
3 years ago
I needed to create a combo box which lists all years that appear in a date field. For example, I have an [AppointmentDate] field in my query with a short date.

I then set up a separate field in the query using the year part of date to show just the years:
Year: Year([AppointmentDate])

Then, with the help of ChatGPT, I made this SQL statement to feed the combo box which I will use to filter a listbox. The great thing about this is it'll automatically update whenever new years are entered!

SELECT DISTINCT Year FROM FiguresQ;
Dan Jackson OP  @Reply  
            
3 years ago

Dan Jackson OP  @Reply  
            
3 years ago

Dan Jackson OP  @Reply  
            
3 years ago

Dan Jackson OP  @Reply  
            
3 years ago

Dan Jackson OP  @Reply  
            
3 years ago

Richard Rost  @Reply  
          
3 years ago
Looks good, except I'd never have a field called "Year." It's a reserved word and function name. Thanks for sharing, though. :)
Dan Jackson OP  @Reply  
            
3 years ago
Yeah, i actually changed it afterwards. Was just buggering around at the time

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/7/2026 7:42:44 AM. PLT: 1s