• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 131
  • Last Modified:

select statement

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?...
  • 2
1 Solution
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.
sorry mistype, not result set but record set
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:" & getstats.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:" & getstats.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


Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now