Access 2007-2019
Access 2000-2003
Access Seminars
TechHelp Support
Tips & Tricks
Access Forum
Course Index
Topic Glossary
Insider Circle
 
Home   Courses   Seminars   Templates   Help   TechHelp   Forums   Contact   Join   Order   Logon  
 
Home > Forums > Developers
 
Access Developer Forum

This is a Forum for students in my Access Developer courses. Yes, you can still post questions in the comments section of the individual courses, but I will be using this Forum to post general notifications, ideas for future lessons, etc.

I recommend you subscribe to this Forum if you're interested in getting these kinds of updates. I'm not going to send out individual emails for everything.
 

Click Here to Post a comment and start a new discussion

 

ComboBox Rowsource Upload Images   Link 
Abraham Breuer 
8 days ago
Hi!

I have set up a form with 2 Comboboxes 1- CustomerCombo 2- SalesRepCombo,

then used the after update event:

   Private Sub CustomerCombo_AfterUpdate()

      SalesRepCombo.RowSource = "SELECT SalesRepID, SalesRepFullName, FROM SalesRepCustomerQ" & _
                             " WHERE CustomerID=" & CustomerCombo & _
                             " ORDER BY SalesRepID ;"
  
   End Sub


if u have a look at the code you will see that the select statement is based on a query, the reason why I did so is: because my SalesReps are not directly related to the customers (see screenshot the relations),
to make it clear the customers are companies which have employees and sales reps are their employees, (and the database is an electric company who takes calls from companies so a company is for me a customer and when taking a call I need to keep track who of there employees contact us)  so I did not just put in in salesRepT the ID where they are employed because they might work at more then 1 company! therefore I built a separate table to make a one-to-many relation.

I built a query to put together the sales rep full name and the places where he works (which can be more than 1 place) so now I am able to use this query for my Combobox, but I want that the SalesRepCombo should be based on the CustomerCombo, but looks it does not work throwing out an error msg

Any solution?
Abraham Breuer
8 days ago

Abraham Breuer
8 days ago

Alex Hedley
8 days ago
SalesRepCombo.RowSource = "SELECT SalesRepID, SalesRepFullName, FROM SalesRepCustomerQ" & _
                             " WHERE CustomerID=" & CustomerCombo & _
                             " ORDER BY SalesRepID ;"


Comma (,) before the FROM
SalesRepFullName, FROM
Alex Hedley
8 days ago
I tend to set the ROWSOURCE to its own String variable
Then you can do Debug.Print(sql) or msgbox(sql) or status(sql) to see what the final SQL statement is
That way you can copy it into a new Query and try it there
Easier to spot mistakes then.
Abraham Breuer
8 days ago
Thanx Alex! yep that silly comma that wastes my time...
BTW am moving to the UK soon...!
Add a Reply

Show All Comments

Start a NEW Conversation
 
Only students may post right now. Click here for more information on how you can set up an account. If you are a student, please LOG ON first.
 
Subscribe
 

You may want to read these articles from the 599CD News:

6/14/2021Access Developer 29
6/13/2021Multi-Field Find
6/10/2021Month-Over-Month
6/8/2021Access SQL Server Online Seminar
6/8/2021Access SQL Server Lessons
6/8/2021Access SQL Server Online
6/5/2021Access Forum Posting Rules
6/4/2021MsgBox
6/3/2021Disable Bypass Key
6/3/2021Show/Hide Buttons
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Account Login
Online Theater
Downloads
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
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
Email Richard
Mailing Address
Phone Number
Fax Number
Course Survey
Blog RSS Feed    Twitter

YouTube Channel    LinkedIn
Keywords: microsoft access developer forum  PermaLink