Apply a new filter to open form

F

Fev

Hi
I have a form that displays when a text box "Member Name"is clicked in
a form "Household Members", and am using the IsLoaded Function from
NorthWind. I would like the form Family_Member to remain open but
show another member when it is clicked from the calling form - ie
clear the previous filter and apply a new filter without unloading and
reopening the form. Is this posible?

Private Sub Family_Member_Click()
If IsLoaded("Church Member") Then
Me.Filter = "[PersonalID]=""& Me.PersonalID"""
Me.FilterOn = True
Me.Requery
Else
DoCmd.OpenForm "Church Member", , , "[PersonalID]=" &
Me.PersonalID, , acDialog

End If

End Sub

Thanks
 
B

banem2

Hi
I have a form that displays when a text box "Member Name"is clicked in
a form "Household Members", and am using the IsLoaded Function from
NorthWind.  I would like the form Family_Member to remain open but
show another member when it is clicked from the calling form - ie
clear the previous filter and apply a new filter without unloading and
reopening the form.  Is this posible?

Private Sub Family_Member_Click()
If IsLoaded("Church Member") Then
    Me.Filter = "[PersonalID]=""& Me.PersonalID"""
    Me.FilterOn = True
    Me.Requery
Else
    DoCmd.OpenForm "Church Member", , , "[PersonalID]=" &
Me.PersonalID, , acDialog

End If

End Sub

Thanks

This is a bit confusing. If you want to filter form "Household
Members" by selection on "Member Name", then use this code:

Private Sub Family_Member_Click()
If Not IsLoaded("Church Member") Then
DoCmd.OpenForm "Church Member"
End If
Forms![Church Member].Form.Filter = _
"[PersonalID]= " & Forms![Household Members]!PersonalID
Forms![Church Member].Form.FilterOn = True
Forms![Church Member].Form.Requery
End Sub

Regards,
Branislav Mihaljev
Microsoft Access MVP
 
F

Fev

Hi
I have a form that displays when a text box "Member Name"is clicked in
a form "Household Members", and am using the IsLoaded Function from
NorthWind.  I would like the form Family_Member to remain open but
show another member when it is clicked from the calling form - ie
clear the previous filter and apply a new filter without unloading and
reopening the form.  Is this posible?
Private Sub Family_Member_Click()
If IsLoaded("Church Member") Then
    Me.Filter = "[PersonalID]=""& Me.PersonalID"""
    Me.FilterOn = True
    Me.Requery
Else
    DoCmd.OpenForm "Church Member", , , "[PersonalID]=" &
Me.PersonalID, , acDialog

This is a bit confusing. If you want to filter form "Household
Members" by selection on "Member Name", then use this code:

Private Sub Family_Member_Click()
If Not IsLoaded("Church Member") Then
  DoCmd.OpenForm "Church Member"
End If
Forms![Church Member].Form.Filter = _
  "[PersonalID]= " & Forms![Household Members]!PersonalID
Forms![Church Member].Form.FilterOn = True
Forms![Church Member].Form.Requery
End Sub

Regards,
Branislav Mihaljev
Microsoft Access MVP- Hide quoted text -

- Show quoted text -

Hi Branislav
Thanks for the code - it now updates the form with the new filter
beautifully.
However I am now presented with a further problem, my calling form was
set to load maximised, and I had the filtered form as a acDialog, with
the X and Y positions set. With your current code (with a little
modification), when I click on a second Household Member, this form
(HH Member) becomes restored, and the "Church Member" form appears
behind this. I then have to click on the "Church Member" to bring it
to the front. Here is the code so far:

Private Sub Family_Member_Click()
If Not IsLoaded("Church Member") Then
DoCmd.OpenForm "Church Member", acLayout
End If
Forms![Church Member].Form.Filter = _
"[PersonalID]=" & Me.PersonalID
Forms![Church Member].Form.FilterOn = True
Forms![Church Member].Form.Requery

End Sub
Is there a way to keep the calling form "Household Member" maximised
and keep the "Church Member" form in front of that?
Thanks
 
B

banem2

Hi
I have a form that displays when a text box "Member Name"is clicked in
a form "Household Members", and am using the IsLoaded Function from
NorthWind.  I would like the form Family_Member to remain open but
show another member when it is clicked from the calling form - ie
clear the previous filter and apply a new filter without unloading and
reopening the form.  Is this posible?
Private Sub Family_Member_Click()
If IsLoaded("Church Member") Then
    Me.Filter = "[PersonalID]=""& Me.PersonalID"""
    Me.FilterOn = True
    Me.Requery
Else
    DoCmd.OpenForm "Church Member", , , "[PersonalID]=" &
Me.PersonalID, , acDialog
End If
End Sub
Thanks
This is a bit confusing. If you want to filter form "Household
Members" by selection on "Member Name", then use this code:
Private Sub Family_Member_Click()
If Not IsLoaded("Church Member") Then
  DoCmd.OpenForm "Church Member"
End If
Forms![Church Member].Form.Filter = _
  "[PersonalID]= " & Forms![Household Members]!PersonalID
Forms![Church Member].Form.FilterOn = True
Forms![Church Member].Form.Requery
End Sub
Regards,
Branislav Mihaljev
Microsoft Access MVP- Hide quoted text -
- Show quoted text -

Hi Branislav
Thanks for the code - it now updates the form with the new filter
beautifully.
However I am now presented with a further problem, my calling form was
set to load maximised, and I had the filtered form as a acDialog, with
the X and Y positions set.  With your current code (with a little
modification), when I click on a second Household Member, this form
(HH Member) becomes restored, and the "Church Member" form appears
behind this.  I then have to click on the "Church Member" to bring it
to the front.  Here is the code so far:

Private Sub Family_Member_Click()
If Not IsLoaded("Church Member") Then
  DoCmd.OpenForm "Church Member", acLayout
End If
Forms![Church Member].Form.Filter = _
  "[PersonalID]=" & Me.PersonalID
Forms![Church Member].Form.FilterOn = True
Forms![Church Member].Form.Requery

End Sub
Is there a way to keep the calling form "Household Member" maximised
and keep the "Church Member" form in front of that?
Thanks

Yes, you can use PopUp property. Open form "Church Member" in design
view and in Properties window find PopUp property. Change it from "No"
to "Yes". If you like to move focus back to calling form you can use
additional line of code as last line in above Sub: Forms!Form
Name.SetFocus.

Regards,
Branislav Mihaljev
Microsoft Access MVP
 

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