Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 441523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T20:58:52+00:00 2026-05-12T20:58:52+00:00

I am having trouble setting the row source of a certain combo box on

  • 0

I am having trouble setting the row source of a certain combo box on my form (viewed as a continuous form, although I also seem to have some problems in single-form mode).

The combo-box is bound to a field called supplierID, and is meant to present the user with a list of all the possible suppliers for an item. The row-source I am using for the combo-box is:

SELECT DISTINCT Suppliers.name, Suppliers.supplierID
FROM Suppliers
INNER JOIN PartsSuppliers ON Suppliers.supplierID=PartsSuppliers.supplierID 
WHERE PartsSuppliers.partID = partID;

When I view this query in the query designer (with a partID hard-coded), it works fine – it selects all the possible suppliers for the chosen item, and doesn’t show any other items. But when I look at the items in the combo-box, it shows all the suppliers present in the PartsSuppliers table (which has just two columns, mapping the parts to the possible suppliers for them).

I have also tried to set the combo-box’s RowSource using some VBA in the OnFocus event (hardcoding the partID value in), but it never seems to change the RowSource. The VBA code I am using is:

Private Sub supplierID_GotFocus()
    Dim query As String

    query = "SELECT DISTINCT Suppliers.name, PartsSuppliers.supplierID "
    query = query & "FROM Suppliers INNER JOIN PartsSuppliers ON Suppliers.supplierID = PartsSuppliers.supplierID "
    query = query & "WHERE (((PartsSuppliers.partID)=" & partID & "));"

    supplierDropDown.RowSource = query
    supplierDropDown.Requery
End Sub

I also tried opening that query in a RecordSet, and then using setting that RecordSet as the combo-box’s RecordSet, but that didn’t work either.

What am I doing wrong, or is there some other way that I should be looking at to make the correct drop down?

N.B. I have seen Custom row source for combo box in continuous form in Access, but that accepted solution didn’t work for me either.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T20:58:52+00:00Added an answer on May 12, 2026 at 8:58 pm

    Use the OnEnter and OnExit events to change out your RowSource.

    Private Sub supplierID_Enter()
        supplierDropDown.RowSource = _
            "SELECT DISTINCT Suppliers.name, PartsSuppliers.supplierID " & _
            "FROM Suppliers INNER JOIN PartsSuppliers ON Suppliers.supplierID = PartsSuppliers.supplierID " & _
            "WHERE PartsSuppliers.partID = " & partID & ";"
    End Sub
    
    Private Sub supplierID_Exit()
        supplierDropDown.RowSource = _
            "SELECT DISTINCT Suppliers.name, PartsSuppliers.supplierID " & _
            "FROM Suppliers INNER JOIN PartsSuppliers ON Suppliers.supplierID = PartsSuppliers.supplierID;"
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After having read Ian Boyd 's constructor series questions ( 1 , 2 ,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.