filter subform combo box by mainform combo box

arifmasum

Registered User.
Local time
Today, 22:52
Joined
Dec 10, 2007
Messages
72
Here is my problem. Trying to solve from last week. I am working with case files. In my main form i have a combo box named cboCaseType and in my sub form i have another combo box names cboCaseStage. I want to filter sub form combo box (cboCaseStage) by main form combo box (cboCaseType). I learned that i need to cascade combo boxes. but i can not understand what code i should write to filter sub form combo box by main form combo box. file attached with the post. Any help will be appreciated. Pls help me if you can. Thanks and regards.
 

Attachments

Hi,

To do this you will need to change the RowSource for the combobox on your subform, and add some code for the combobox on the main form.

Row source for subform combobox:

Code:
SELECT tblCaseStage.CaseStageID, tblCaseStage.CaseStage, tblCaseStage.CaseType
FROM tblCaseStage
WHERE (((tblCaseStage.CaseType)=[Forms]![frmMain]![CaseType]));

AfterUpdate event for main form combobox :

Code:
Private Sub CaseType_AfterUpdate()
    Me!frmSub!CaseStage.Requery
End Sub
 
Thank you so very much dear sparks80.. Much appreciated your kind help... :)
 
You guys are true life savers, my head was spinning trying to figure this out. Thank you!
 

Users who are viewing this thread

Back
Top Bottom