Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


select statement

Posted on 1999-07-01
Medium Priority
Last Modified: 2012-05-04
Hi i have a form in VB where i select a value from a customer combo box and and i should get related values for that particular cuatomer in another combobox say products.
I have a access database where i have these two fields in one table. when i select a customer in one combobox i should get all related products values in another combobox. can u please help  me out?...
Question by:garlapad
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
  • 2

Accepted Solution

setiawan earned 100 total points
ID: 1521405
in combobox1 change you can add item the related values in combobox1, of course before that you must do some query
then from the result set, you put it all in combobox2 by additem method.

Expert Comment

ID: 1521406
sorry mistype, not result set but record set

Expert Comment

ID: 1521407
try this:
type UserStats
        Name as string * 40
        age as integer
end type
dim getstats as UserStats

'   module level code here : Public Const John = 1:Public Const Steve = 2
Private Sub Combo1_Click()
select case combo1.listindex
         case 1                                            'John is selected  
         open "DATABASE" for random as #1 len = len(getstats)
         get #1,John,getstats                             'skip to johns record
         cmboNAME.additem "NAME:" & & " AGE: " & getstats.age
         close #1        
         case 2                                            'Steve is selected
         open "DATABASE" for random as #1 len = len(getstats)
         get #1,Steve,getstats                             'skip to johns record
         cmboNAME.additem "NAME:" & & " AGE: " & getstats.age
         close #1
end select

of course the fields in UDT getstats could be anything in your database you want to retrieve



Featured Post

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!

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

715 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