Filter subform combobox on option button in main form

E

Emma

Okay, I think I'm getting closer. However, still running
into errors.

I think if I get this error tackled the rest will fall
into place.

Option Group AfterUpdate code is:

Private Sub Discipline_Frame_AfterUpdate()
Dim strSQL As String
'Select the discline on which to filter from Option group
strSQL = "Select " & Me!Discipline_Frame
strSQL = strSQL & " from Tbl_Lit_Broch"
Forms!Sfrm_Tbl_Lit_Broch_Line!
Lit_Broch_Combo.RowSourceType = "Table/Query"
Forms!Sfrm_Tbl_Lit_Broch_Line!
Lit_Broch_Combo.RowSource = strSQL

'Requery of combo box control
Forms!Sfrm_Tbl_Lit_Broch_Line!Lit_Broch_Combo.Requery

End Sub

Error that I am getting is

"Run-time Error '2450'
Microsoft Access can't find the
form "Sfrm_Tbl_Lit_Broch_Line" referred to in in the Macro
or Visual Basic Code."

The form referred to is my subform than contains my combo
box "Lit_Broch_Combo". Why can't access find my subform.

-----Original Message-----
If you are asking how to limit the combo so the choices in its dropdown list
are limited to those that match the Discipline field in the main form, use
the AfterUpdate event of the option group in the main form to create a SQL
string and assign it to the RowSource of the combo. (You may also need to
handle the Undo event of the main form.) More information:
http://www.mvps.org/access/forms/frm0028.htm

If you are asking how to limit the subform so its records are filtered to
the Discipline selected in the main form, that woud normally be done by
setting the LinkMasterFields and LinkChildFields properties of the subform
control. Open the main form in design view, to set these properties.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.




.
..
 
E

Emma

Regroup.

Please disregard
-----Original Message-----
Okay, I think I'm getting closer. However, still running
into errors.

I think if I get this error tackled the rest will fall
into place.

Option Group AfterUpdate code is:

Private Sub Discipline_Frame_AfterUpdate()
Dim strSQL As String
'Select the discline on which to filter from Option group
strSQL = "Select " & Me!Discipline_Frame
strSQL = strSQL & " from Tbl_Lit_Broch"
Forms!Sfrm_Tbl_Lit_Broch_Line!
Lit_Broch_Combo.RowSourceType = "Table/Query"
Forms!Sfrm_Tbl_Lit_Broch_Line!
Lit_Broch_Combo.RowSource = strSQL

'Requery of combo box control
Forms!Sfrm_Tbl_Lit_Broch_Line!Lit_Broch_Combo.Requery

End Sub

Error that I am getting is

"Run-time Error '2450'
Microsoft Access can't find the
form "Sfrm_Tbl_Lit_Broch_Line" referred to in in the Macro
or Visual Basic Code."

The form referred to is my subform than contains my combo
box "Lit_Broch_Combo". Why can't access find my subform.

records
are filtered to
..


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top