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 
Populate Combo w Recordset
Juan C Rivera 
            
6 years ago
TO : Fleet Admiral
1st Merry Christmas,
topic: I got to conect to the rs display a sting to drop down box but when I move thruogh the rs to EOF the last string is all thats in the dropdown.  How can I populate the dropdown a recordset.  I am using Geir Arne database as a sample to see if I can do this... So I set up a dropdown to pull only one set of boxes.  If I have FE30001 to FE30020 I like to select FE3001 and only display in a form boxes A1 to H8 only for FE3001
I look on the web there are thousands of exsample but code is to complex and cant make head or tails.  Do you have anything already showing this? if not can we do something in a developer clas of tech help?

V/r
Juan
Live Long and Prosper
Richard Rost  @Reply  
          
6 years ago
By "drop down" do you mean a combo box? If so, it's the exact same method I've shown in pretty much every class since Developer 16. You loop thru the RS and AddItem for each item you want to add.
Juan C Rivera OP  @Reply  
            
6 years ago
Big thanks it was the add item i was missing now just got to figure out how to add a second combobox and the apply a filter.
Recordsets are awsome....

V/r
Juan
Richard Rost  @Reply  
          
6 years ago
Indeed!
Juan C Rivera OP  @Reply  
            
6 years ago
Hello Richard, need to ask please look at my code and let me know where did I go wrong.

Set rsMajor = db.OpenRecordset("SELECT * FROM MajorT WHERE MSDivisionID=""" & CMBDivision & """")

I have 2 combobox 1st one displays all my divisions, 2nd combobox I like to filter out all but what is in the 1st combibox.
ie if i pic division 1 I should only see division 1 lineitems but I see them all...

I have named the combobox cmbDivision and cmbMajor
Your guidence is much appriciated.

V/r
Juan
Live long and proper.
Alex Hedley  @Reply  
           
6 years ago
Is MSDivisionID a number field or a text field?

With it having ID in the name Id expect it to be a number.

One thing to try is:

Dim sqlString As String
sqlString = your query
Debug.Print sqlString

Then copy that into a new Query window and run it manually.
See what error message you get.

Id guess you just need to handle the value as a number and not a string like:

Set rsMajor = db.OpenRecordset("SELECT * FROM MajorT WHERE MSDivisionID=" & CMBDivision)
Juan C Rivera OP  @Reply  
            
6 years ago
BIG THANKS
I was reviewin D16 and stated to make a hidden box....
I whould have not thought of number field.

Happy Holidays

V/r
Juan
Richard Rost  @Reply  
          
6 years ago
Alex got it. And dates need to be

"SELECT * FROM OrderT WHERE OrderDate<#" & Date() & "#"

Gotta use the # thingies

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 7:13:33 PM. PLT: 0s