Use the AfterUpdate event for the first combo to set the row source for the
second combo. It's also good to put in a function in the GotFocus event to
reset the second combo's row source.

Private Sub cboSelect_AfterUpdate()
Dim strSQL

strSQL = "SELECT PrimaryKey, Name FROM table WHERE ForeignKey = " &_
Me.cboSelect
Me.cboSelect2.RowSource = strSQL
Me.cboSelect2.SetFocus

End Sub

Private Sub cboSelect_GotFocus()
'Clear the other searcg combo boxes
Me.cboSelect2.RowSource = ""
Me.cboSelect2 = ""
End Sub

Guy Harley

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of eliotchs
Sent: Friday, 10 March 2006 2:02 AM
To: [email protected]
Subject: [ms_access] ? on Combobox with different values

Hi,
I want to have a combobox with 1 of 6 values.
Depending on the value a second combobox will have
different choices.
Example
cboQuestion1..choices are 1,2,3,4,5,6
if cboQuestion1 = 1 then
cboQuestion2 should have choices A,B,C
if cboQuestion1 = 2 then
cboQuestion2 should have choices D,E,F

etc....

Thanks In Advance

Joe 



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ms_access/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to