Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

PopupForm Apply filter to MainForm

PopupForm Apply filter to MainForm

PopupForm Apply filter to MainForm

I have unbound combo boxes on an unbound subform embedded in my main form that provide selections for filters on my (single)main form.  When a selection is made from one or more of the combo boxes the click event on a "go" button triggers a pop-up (continuous)form that returns all the matches.  On the pop up form the user "clicks" the record that is desired.  On that "click" event I want the main form underneath to find the selected record.  Would the code look something like this?

It isn't working

Private Sub Form_Click()

Dim stLinkCriteria As String

DoCmd.ApplyFilter , Me![ContactID] = Forms![frmRolEdit]![ContactID]

End Sub

RE: PopupForm Apply filter to MainForm

You need to activate the filter a different way.
Change your code in the sub form to this.

Private Sub Form_Click()

    Forms("YourMainForm").SetFilter Me.ContactID

End Sub

Put this in your main form module

Public Sub SetFilter(varContactID as Variant)

    DoCmd.ApplyFilter , Me![ContactID] = varContactID

End Sub

Let me know if it works for you.

John A. Gilman

RE: PopupForm Apply filter to MainForm

It didn't work.  It seems like this should be an easier task.

RE: PopupForm Apply filter to MainForm

sorry about the mistake. I should have tested it first!

Put this in the click event on your subform.

Dim strFilter As String
strFilter = "ContactID = " & Me.ContactID
Forms("YourMainFormName").Filter = strFilter
Forms("YourMainFormName").FilterOn = True

You need to be using a Number field type for this to work, if your ContactID is a charactor field let me know.

John A. Gilman

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close