?
Solved

Synchronizing three (3) combo boxes in a form.

Posted on 2009-04-28
8
Medium Priority
?
1,240 Views
Last Modified: 2013-11-27
I have in the form three combo boxes. a)cbo1 , b)cbo2 , c)cbo3.
I want to synchronize cbo1 with cbo2 and cbo2 with cbo3.
When I choose from cbo1 limits the records to cbo2  and then I choose from cbo2 limits the records to cbo3.
If you pleased write the complete code for this to understated.
Thank you
0
Comment
Question by:sathan48
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 24251112
writoing the complate code is impossible, since you have  not given a complete detail about your combo boxes, names, rowsource etc.,,

see this link

http://blogs.msdn.com/access/archive/2009/04/03/template-demonstrates-how-to-synchronize-combo-boxes.aspx
0
 
LVL 7

Expert Comment

by:coffeeshop
ID: 24251177
Add the following code to your form:

The Queries for the Combos must include Combo1Val() and Combo2Val() as WHERE-Clause. You have to change the type "String" to "Long" or whatever you have.
Private sCombo1Val As String
Private sCombo2Val As String
 
Public Property Get Combo1Val() As String
  Combo1Val = sCombo1Val
End Property
Public Property Get Combo2Val() As String
  Combo2Val = sCombo2Val
End Property
 
 
Private Sub cbo1_AfterUpdate()
 
  If Not IsNull(cbo1.Value) Then
    sCombo1Val = cbo1.Value
  Else
    sCombo1Val = ""
  End If
  
  Me.cbo2.Requery
  cbo2_AfterUpdate
 
End Sub
 
Private Sub cbo2_AfterUpdate()
 
  If Not IsNull(cbo2.Value) Then
    sCombo2Val = cbo2.Value
  Else
    sCombo2Val = ""
  End If
  
  Me.cbo3.Requery
 
End Sub

Open in new window

0
 

Author Comment

by:sathan48
ID: 24260954
To capricorn1:
So I give more details:
I have (3) tbls by name  tblContinents , tblCountries , and tblvarieties.
I want to make a form with THREE (3) combo boxes bound to the above tables by name cboContinets , cboCountries and cbovarieties.
When I select an item in  cboContinets drop down list on a form and
limit the choices in the cboCountries  drop down list so the cboCountries list shows only items
related to the item in the cboContinets  , and  when I select an item from cboCountries drop down list on a form and limit the choices in the tblvarieties drop down list so the tblvarieties list shows only items related to the item in the cboCountries drop down.
I appreciate if you can help me with a complete code.
Thank you

0
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 24261195
sathan48,
did you check the link i posted above?
0
 

Author Comment

by:sathan48
ID: 24261765
To capricorn1.
Yes I checked the link and I try it my form.
Don't work as I need , because the combo boxes is unbound.
I want yo be bound with the tables I told you before.
Thank you
 
0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 2000 total points
ID: 24311640
Did you try coffeeshop's code?

The technique you are refreeing to is called "Cascading Lists"
The technique is basically the same for Comboboxes and Listboxes.

Here are some great Tutorials:
http://www.fontstuff.com/access/acctut10.htm

One table
http://www.candace-tripp.com/download/cascadecombo2k.zip
Two Tables
http://www.candace-tripp.com/download/2table_cascadecombo2k.zip

JeffCoachman
0
 

Author Comment

by:sathan48
ID: 24313938
To boag2000
Yes I'll try the coffeshop's code ,but I can't made work.
 I'll try the first link you wrote me , and it's work perfect.
Thank you
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 24314887
Thanks!
;-)
But I see no real reason why coffeshop's code would not work.
Make sure you substitute your actual names for the posted ones.

;-)

JeffCoachman
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses
Course of the Month17 days, 13 hours left to enroll

830 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