8 minutes ago: Please note that the webserver will soon get its weekly reboot at 4:00 am Eastern Time. You may continue to use the site as normal, but you will be logged off at that time. You should be able to log right back on immediately, however. If you are in the process of placing an order, please make sure to complete it as quickly as possible, or come back after the reboot. Thank you. Sorry for any inconvenience.  Dismiss
 
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 
combo box
Hamish 
    
12 years ago
Hi Alex,

I have the following VBA code in the after update of the 1st combo box (cboDepart)

sCategorySource = "SELECT CatID,DepartID, CategoryName FROM VendorSetupT " & _
"WHERE DepartID=" & Me.cboDepart & "" & _"ORDER BY CategoryName"
Me.cboCategory.RowSource = sCategorySource

The problem I'm having, is when I select a field in the 1st combo box (cboDepart) the items is the 2nd combo box (cboCategory) is blank. What could be the reason for this not to appear. Both combo box are value list.

I would appreciate you sound advice with regards to this matter, as I have wasted quite some time trying to figure this out.





Reply from Alex Hedley:

Make sure to add a space before your ORDER BY clause.

"WHERE DepartID=" & Me.cboDepart & " ORDER BY CategoryName"

Otherwise your sql statement will look like
"WHERE DepartID=xORDER BY CategoryName"

A good way to check things like this is to use a DEBUG.PRINT statement.
So you could have
DEBUG.PRINT sCategorySource
And check in your immediate window in the VBA editor (Ctrl+G)

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/17/2026 3:38:27 AM. PLT: 1s