DBCombo: Set source to select distinct??

Posted on 2003-03-05
Medium Priority
Last Modified: 2013-12-25
I'm currently working with a DBCombo box [DBCombo1] that pulls data from a column called [Team_Affiliation].  Unfortunately there are several hundred records so what I'd like to do is only select distinct records to show in this combo box.  Right now I am setting the properties for [DBCombo1] at design time through the properties window.  It references a data connector [data1] which is connected to my database named[Emp_Data], table name [Complete_Emp].

If it is possible to connect the data to a DBCombo through a data environment that would be ideal, but I can also do it through a standard ADO connection string which is also set up.

Your help is appreciated!
Question by:TinLemon
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +1

Expert Comment

ID: 8076598
So you're asking about the query to extract distinct data from your table ? am I reading this right ? or are you asking about something else ?

Author Comment

ID: 8076642
No... I fully understand how to pull distinct data using a query.  I'm trying to direct the source of a DBCombo to pull distinct data from a field in a table instead of pulling hundreds of records like it normally does.

Expert Comment

ID: 8076681
How about setting the source to a Command in the connection of the DataEnvironment that return the result ot the query?
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 8076712
The query does not exist yet, so I try to write the source of the DBCombo as an SQL statement that "select distinct [team_affiliation] from [complete_emp]".  It's important to note that [complete_emp] is an existing query in my Access DB.

So in short, I am trying to set the source of my DBCombo to select distinct from a field in an existing query.


Expert Comment

ID: 8083662
The command object in the DE can be created with a sql statment, therefore you can create the result from your current query only it will run from the command object.

Why do a query in a query for one field?

Whouldn't it be easier to just query the table the [complete_emp] query looks at to get that field?

Just a thought!!!!!

Author Comment

ID: 8152560
Mods... I never found a sufficient answer and went with a completely UNRELATED solution.  How do I handle this?

Expert Comment

ID: 8154658
If you will post your solution here (unless it is against the membership agreement), then I can refund your points.

Experts, a refund request has been made.  You have 72 hours to object.  As long as TinLemon provides the answer, I intend to honor the request.

Community Support Moderator @Experts Exchange

Author Comment

ID: 8169680
My solution was to use a regular combo box, and then just add each item to it one-by-one by using a loop.

With DataEnv
        With .rsTable1
        For a = 1 To DataEnv.rsTable1.RecordCount
            If IsNull(![Field1]) Then
                a = a
                Combo1.AddItem (![Field1])
            End If
        Next a
End With


Accepted Solution

SpideyMod earned 0 total points
ID: 8173150
PAQ'd and all 20 points refunded.

Community Support Moderator @Experts Exchange

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month12 days, 4 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question