Group:  Microsoft Access » microsoft.public.access.formscoding
Thread: Filter Records in a Subform from a ComboBox within a Parent Form

Geek News

Filter Records in a Subform from a ComboBox within a Parent Form
Joe Coulter 12/3/2008 3:01:02 PM
Hi group

Hope someone can help me with this one. its been driving me crazy

I hope that the description I have annotated below is adequate:-

I have a continuous form “FRM_REASONS” which shows records with 3 fields in
each
1 = “Type_Name”
2 = “Reason_Code”
3 = “Reason_Description”

On the Header of the Form “FRM_REASONS” I have a ComboBox “Select_Type”
which contains values from another Table “Tbl_Types” which has 2 fields
1 = “Type_Code”
2 = “Type_Name”

On the AfterUpdate Event of ComoBox “Select_Type”, I have the following Code:-

Private Sub Select_Type_AfterUpdate()
DoCmd.ApplyFilter , "Typ_Code = Forms!Frm_Reasons!Select_Type"
End Sub

This works fine and filters the records within the form to the value
selected within the ComboBox

Problem
I have created a Form “FRM_HEADER” to use as a Navigation Form on which I
have a tab Control “TAB01” With 3 tabs, one of these Tabs “REASONS” holds the
Form “Frm_Reasons” as a Sub Form.

Now that the Form “Frm_Reasons” is these, the ComboBox “Select_Type” no
longer works.
The Values still Appear but cannot be selected.

I have tried Modifying the AfterUpdate Event of the ConboBox as follows:-

Added the Name of the Navigation Form “FRM_HEADER” to the Path within the Code
DoCmd.ApplyFilter , "Typ_Code =
Forms!FRM_HEADER!Frm_Reasons!Select_Type"

Added the Name of the Navigation Form “FRM_HEADER” and TAB “TAB01” to the
Path within the Code
DoCmd.ApplyFilter , "Typ_Code =
Forms!FRM_HEADER!TAB01!Frm_Reasons!Select_Type"

Both the changes failed to work, the values within the ComboBox
“Select_Type” can be seen when clicked, but none of them can be selected,
it’s as if the ComboBox was Locked.


Thanks in anticipation, Any Suggestions will be greatly appreciated


Re: Filter Records in a Subform from a ComboBox within a Parent Form
"Wolfgang Kais" <w.kais[ at ]discussions.microsoft.com> 12/3/2008 10:27:52 PM
Hello Joe.

Joe Coulter wrote:
[Quoted Text]
> [...]
> On the AfterUpdate Event of ComoBox "Select_Type",
> I have the following Code:-
>
> Private Sub Select_Type_AfterUpdate()
> DoCmd.ApplyFilter , "Typ_Code = Forms!Frm_Reasons!Select_Type"
> End Sub
>
> This works fine and filters the records within the form to the value
> selected within the ComboBox
>
> Problem
> I have created a Form "FRM_HEADER" to use as a Navigation Form on
> which I have a tab Control "TAB01" With 3 tabs, one of these Tabs
> "REASONS" holds the Form "Frm_Reasons" as a Sub Form.
>
> Now that the Form "Frm_Reasons" is these, the ComboBox "Select_Type"
> no longer works.
> The Values still Appear but cannot be selected.
>
> I have tried Modifying the AfterUpdate Event of the ConboBox
> as follows:-
>
> Added the Name of the Navigation Form "FRM_HEADER" to the Path within
> the Code
> DoCmd.ApplyFilter , "Typ_Code =
> Forms!FRM_HEADER!Frm_Reasons!Select_Type"
> [...]

Try to replace Frm_Reasons in your expression by the name of the
subform control on your tab page. To find out the name of that control:
Draw a rectangle with the mouse on the tab from outside the subform
into the subform such that only the subform control is selected. Then
read the name from the properties window.

--
Regards,
Wolfgang


Re: Filter Records in a Subform from a ComboBox within a Parent Fo
Joe Coulter 12/4/2008 8:02:15 AM
Hello Wolfgang

Thank you for your reply, I tried your suggestion, unfortunately that did
not work, I also tried removing the Tab Control and placing the Form
Frm_Reasons directly onto the FRM_HEADER, this also failed, so frustrating
lol.

Anyway I will continue to Persevere with this, If I come up with an answer,
I will post it.

Again, Thanks

Joe

"Wolfgang Kais" wrote:

[Quoted Text]
> Hello Joe.
>
> Joe Coulter wrote:
> > [...]
> > On the AfterUpdate Event of ComoBox "Select_Type",
> > I have the following Code:-
> >
> > Private Sub Select_Type_AfterUpdate()
> > DoCmd.ApplyFilter , "Typ_Code = Forms!Frm_Reasons!Select_Type"
> > End Sub
> >
> > This works fine and filters the records within the form to the value
> > selected within the ComboBox
> >
> > Problem
> > I have created a Form "FRM_HEADER" to use as a Navigation Form on
> > which I have a tab Control "TAB01" With 3 tabs, one of these Tabs
> > "REASONS" holds the Form "Frm_Reasons" as a Sub Form.
> >
> > Now that the Form "Frm_Reasons" is these, the ComboBox "Select_Type"
> > no longer works.
> > The Values still Appear but cannot be selected.
> >
> > I have tried Modifying the AfterUpdate Event of the ConboBox
> > as follows:-
> >
> > Added the Name of the Navigation Form "FRM_HEADER" to the Path within
> > the Code
> > DoCmd.ApplyFilter , "Typ_Code =
> > Forms!FRM_HEADER!Frm_Reasons!Select_Type"
> > [...]
>
> Try to replace Frm_Reasons in your expression by the name of the
> subform control on your tab page. To find out the name of that control:
> Draw a rectangle with the mouse on the tab from outside the subform
> into the subform such that only the subform control is selected. Then
> read the name from the properties window.
>
> --
> Regards,
> Wolfgang
>
>
>
Re: Filter Records in a Subform from a ComboBox within a Parent Fo
"Wolfgang Kais" <w.kais[ at ]discussions.microsoft.com> 12/5/2008 5:50:53 AM
Hello Joe.

Joe Coulter wrote:
[Quoted Text]
> Hello Wolfgang
>
> Thank you for your reply, I tried your suggestion, unfortunately that
> did not work, I also tried removing the Tab Control and placing the
> Form Frm_Reasons directly onto the FRM_HEADER, this also failed, so
> frustrating
> lol.
>
> Anyway I will continue to Persevere with this, If I come up with an
> answer, I will post it.

You could try to use this cide instead (no matter where tho form is
placed):

Me. Filter = "Type_code=" & Me.Select_Type
Me.FilterOn = True

(If Type_Code is of type text, it should be:
"Type_code='" & Me.Select_Type & "'")

--
Regards,
Wolfgang


Re: Filter Records in a Subform from a ComboBox within a Parent Fo
Joe Coulter 12/5/2008 11:12:02 AM
Thanks again Wolfgang

I will try your suggestion and let you know the result.

Regards

Joe

"Wolfgang Kais" wrote:

[Quoted Text]
> Hello Joe.
>
> Joe Coulter wrote:
> > Hello Wolfgang
> >
> > Thank you for your reply, I tried your suggestion, unfortunately that
> > did not work, I also tried removing the Tab Control and placing the
> > Form Frm_Reasons directly onto the FRM_HEADER, this also failed, so
> > frustrating
> > lol.
> >
> > Anyway I will continue to Persevere with this, If I come up with an
> > answer, I will post it.
>
> You could try to use this cide instead (no matter where tho form is
> placed):
>
> Me. Filter = "Type_code=" & Me.Select_Type
> Me.FilterOn = True
>
> (If Type_Code is of type text, it should be:
> "Type_code='" & Me.Select_Type & "'")
>
> --
> Regards,
> Wolfgang
>
>
>
Re: Filter Records in a Subform from a ComboBox within a Parent Fo
Joe Coulter 12/5/2008 12:42:02 PM
Hello Wolfgang

Works a Treat

Many Thanks

Joe


"Joe Coulter" wrote:

[Quoted Text]
> Thanks again Wolfgang
>
> I will try your suggestion and let you know the result.
>
> Regards
>
> Joe
>
> "Wolfgang Kais" wrote:
>
> > Hello Joe.
> >
> > Joe Coulter wrote:
> > > Hello Wolfgang
> > >
> > > Thank you for your reply, I tried your suggestion, unfortunately that
> > > did not work, I also tried removing the Tab Control and placing the
> > > Form Frm_Reasons directly onto the FRM_HEADER, this also failed, so
> > > frustrating
> > > lol.
> > >
> > > Anyway I will continue to Persevere with this, If I come up with an
> > > answer, I will post it.
> >
> > You could try to use this cide instead (no matter where tho form is
> > placed):
> >
> > Me. Filter = "Type_code=" & Me.Select_Type
> > Me.FilterOn = True
> >
> > (If Type_Code is of type text, it should be:
> > "Type_code='" & Me.Select_Type & "'")
> >
> > --
> > Regards,
> > Wolfgang
> >
> >
> >

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net