Hi,
There may be various ways to do it. But I find my way is easiest.
I created a db for you for the raised topic but unfortunately I don't see any attachment facility here. Anyhow.
Considering your 2 combo boxes named as CboName & CboModule those are placed on the form, do the following :
1. Delete the rowsource (if u created combo based on query / table)of your second combo box (CboModule) and AfterUpdate event of first combo (i.e. CboName) write down following code lines.
Dim Qst As String
Qst = "SELECT T_Tests.TestName,T_Tests.ModuleCode FROM T_Tests Where T_Tests.TestName='" & Me.CboName & "'"
Me.CboModule.RowSource = Qst
Me.CboModule.SetFocus
2. OnGotFocus event of 2nd combo (CboModule) write following line:
Me.CboModule.DropDown
It works smoothly.
With kind regards,
Ashfaque
N. B. : To make it more productive, do not forget to put DISTINCT clause in your first combo query.
|